Iinserting default values by variable in html form
Posted: Sat Sep 24, 2011 3:46 pm
Hi All,
I have an HTML form that i would like to preload with default values by setting variables rather than hard coding the form itself. I have not been able to figure out how to do this though. Here is my function:
Does anyone have any thoughts on how to do this.
Thank you,
KC
I have an HTML form that i would like to preload with default values by setting variables rather than hard coding the form itself. I have not been able to figure out how to do this though. Here is my function:
Code: Select all
function render_form()
{
$word = "dog";
$limit = "100";
$site = "dogs.com";
echo '<h2>QUERY FORM:</h2><form id="form1" name="form1" method="post" action="">
<table border="0" cellpadding="5">
<tr>
<td>Site Name </td>
<td>
<label>
<input name="site" type="text" id="site" value=$site size="60"/>
</label>
</td>
</tr>
<tr>
<td>Keywords</td>
<td><label>
<input name="keywords" type="text" id="keywords" value= $word size="60"/>
</label></td>
</tr>
<tr>
<td>Limit</td>
<td><label>
<input name="limit" type="text" id="limit" value=$limit />
</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="Submit" value="Submit" />
</label></td>
</tr>
</table> </form>';
}
Thank you,
KC