drop down list in php
Posted: Tue Aug 16, 2005 9:40 am
I've got a rather odd occurance in my php code thats causing me some issues. I used the following code to make my drop down list.
then go to the edit page to print the info from it out like so.
and all I get is the first word of the value chosen in the dropdown list :/. Does anyone have any ideas what may cause this odd occurance?
Code: Select all
function EditScreen()
{
$link = odbc_connect("database","username","password");
$qquery = "Select Question from tblQuestions";
$qresult = odbc_exec($link,$qquery);
print('<FORM METHOD = "POST" ACTION = "edit.php">');
print('<SELECT NAME="question">');
while(odbc_fetch_row($qresult))
{
$question = odbc_result($qresult,"Question");
print('<OPTION VALUE ='. "$question".'>'."$question");
}
print('</SELECT>');
print("<BR>");
print('<INPUT TYPE ="submit" NAME = "submit" VALUE ="EditQuestion">');
print('<INPUT TYPE ="submit" NAME = "submit" VALUE ="EditAnswer">');
print("<BR>");
print('</FORM>');
}Code: Select all
session_start();
include 'maintfunctions.php';
switch($_POST['submit'])
{
case 'EditQuestion':
print $_POST['question'];
break;
default:
break;