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

Codes here !

Moderators: egami, macek, gesf

Post Reply

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>


<div align=\"right\"><input type=\"submit\" name=\"mode\" value=\"Submit\"></div>

New php-forum User
New php-forum User
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson

Mon Mar 17, 2003 9:23 am

Code: Select all

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>
<div align="right"><input type="submit" name="mode" value="Submit"></div>
PHP+MySql= Love :)

Post Reply