Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Cannot get listbox to work inside a form variable. help?

Codes here !

Moderators: macek, egami, gesf

Cannot get listbox to work inside a form variable. help?

Postby lsg3385 » Mon Mar 17, 2003 6:12 am

I cannot get a list box to work inside a $form variable. I am sure there is a syntax issue, but I cannot figure it out. Please help.

$form = "
<form name=\"studentCreate\" method=\"post\" action=\"addStudent.php\">

<p>Enter Student's First Name: <input type=\"text\" name=\"sfname\" maxlength=\"30\" size=\"30\" value=\"$studentFirstName\"></p>

Assign Student to a Group:
<select name=\"groupID\">
$listGroups_query = mysql_query(\"SELECT mathgroup.groupID, mathgroup.groupName from mathgroup\");

while($listGroups_record = mysql_fetch_array($listGroups_query)) {

<option value=\"".$listGroups_record["groupID"]."\">".$listGroups_record["groupName"]."</option>

}
</select><br>

<p></p>
<div align=\"right\"><input type=\"submit\" name=\"mode\" value=\"Submit\"></div>
</form>";
lsg3385
New php-forum User
New php-forum User
 
Posts: 5
Joined: Fri Mar 14, 2003 5:35 pm

Postby Romantik » Mon Mar 17, 2003 9:23 am

Code: Select all
<?php
echo '<form name="studentCreate" method="post" action="addStudent.php">
<p>Enter Student's First Name: <input type="text" name="sfname" maxlength="30" size="30" value="'.$studentFirstName.'"></p>
Assign Student to a Group:
<select name="groupID">';
 
$listGroups_query = mysql_query("SELECT mathgroup.groupID, mathgroup.groupName from mathgroup");

while($listGroups_record = mysql_fetch_array($listGroups_query))
{
echo '<option value="'.$listGroups_record["groupID"].'">'.$listGroups_record["groupName"].'</option>';
}
echo '</select><br>
<p></p>
<div align="right"><input type="submit" name="mode" value="Submit"></div>
</form>';
?>
Romantik
New php-forum User
New php-forum User
 
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.