Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP template with function
    text
    copied!<p>I got a function that has to display his values to a html page but it won't work.</p> <p>PHP code:</p> <pre><code>$template = file_get_contents("main.tpl.php"); function updateForm($id) { $query = "SELECT * FROM platen WHERE ID =". $id; $result = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($result)) { $editForm = "&lt;form action='index.php?update&amp;id=". $row['ID'] ."' method='post'&gt;"; $editForm .= "&lt;label for='id'&gt;&lt;span&gt;ID:&lt;/span&gt;&lt;/label&gt; &lt;input name='id' id='id' type='text' value='". $row['ID'] ."'&gt;&lt;/br&gt;"; $editForm .= "&lt;label for='album'&gt;&lt;span&gt;Album:&lt;/span&gt;&lt;/label&gt; &lt;input name='album' id='album' type='text' value='". $row['Album'] ."'&gt;&lt;/br&gt;"; $editForm .= "&lt;label for='band'&gt;Band:&lt;/label&gt; &lt;input name='band' id='band' type='text' value='". $row['Band'] ."'&gt;&lt;/br&gt;"; $editForm .= "&lt;label for='stijl'&gt;Stijl:&lt;/label&gt; &lt;input name='stijl' id='stijl' type='text' value='". $row['Stijl'] ."'&gt;&lt;/br&gt;"; $editForm .= "&lt;label for='medium'&gt;Medium:&lt;/label&gt; &lt;input name='medium' id='medium' type='text' value='". $row['Medium'] ."'&gt;&lt;/br&gt;"; $editForm .= "&lt;label for='datum'&gt;Datum:&lt;/label&gt; &lt;input name='datum' id='datum' type='text' value='". $row['Datum'] ."'&gt;&lt;/br&gt;"; $editForm .= "&lt;label for='prijs'&gt;Prijs:&lt;/label&gt; &lt;input name='prijs' id='prijs' type='text' value='". $row['Prijs'] ."'&gt;&lt;/br&gt;"; $editForm .= "&lt;input class='submit' type='submit' value='Update'&gt;"; $editForm .= "&lt;/form&gt;"; } $template = str_replace("%%editForm%%", $editForm, $template); } echo $template; </code></pre> <p>In my HTML file I got %%editForm%% but when I try this it says $template is undefined. Hope you can help me or know another solution to display the data in the HTML file. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload