Jump to content

Just trying to capture the change in the select box --- help


bstars

Recommended Posts

:'(

I am new to this forum and hoping for some help - this has been a humbling experience. I am trying to create a select box. There is some old data in the file and I want to display that field if it is there - it will not have an associated ID just a name. I do want them to be able to change it. I have the positioner working for this and can fill the select box my problem is this: whenever I try to change the selection is shows but does not save. It reverts back to the last array position. I want to save the selection. I have tried changing names to avoid confusion - I am at my wits end Here is the code and thanks if you can help:

 

echo " <B>DoctorName:</B> \n";

 

 

echo " <SELECT NAME=\"DoctorName\" TABINDEX=\"$TabIndex[10]\">\n";

if ($DoctorID <= 0 && $Doctor != '') {

echo " <OPTION VALUE=\"0\">$Doctor </OPTION>\n";

}

 

if ($DoctorID = 0){

echo " <OPTION VALUE=\"0\">Select a Doctor</OPTION>\n";

}

if ($DoctorID > 0){

echo " <OPTION VALUE=\"0\">$Doc $DocID $DoctorID $Doctor</OPTION>\n";

}

 

$query = mysql_query("select * from Physicians order by PhysicianName");

$numrows= mysql_num_rows($query);

$option = "";

while ($row = mysql_fetch_array($query)) {

$ID2 = $row["PhysicianID"];

$DocID = $row["PhysicianID"];

$Doc = $row["PhysicianName"];

$option = " <OPTION VALUE=\"$ID2\"> $DocID $Doc</OPTION>\n";

if ($DoctorName == $ID2) {

echo " SELECTED";

$DoctorID = $ID2;

$Doctor = $row["PhysicianName"];

$option = " <OPTION VALUE=\"0\"> $DoctorID $Doctor</OPTION>\n";

}

 

 

echo ">$option/OPTION>\n";

}

echo " </SELECT>\n";

echo " </TD>\n";

echo " </TR>\n";

 

forever grateful

Please enclose all of your code with the "code" tags.

 

It is always going to revert back to the array value because you are never modifying the array itself to change those values.  You can change and submit the form a million times but if you never alter the contents of the array itself it will never do anything.

 

Where are you initializing that array and where are you getting the array values initially from?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.