Hello all,
This is my first post and my first outing into the the world of web design and php so forgive me if i'm asking an obvious question.
i have 2 php pages at the moment.
a.php, calls a SQL query to retreive 4 fields (FirstName, Surname, PostCode and a Reference number) from a table based on an input from a form (Postcode). these fields are then displayed as a drop down menu (apart from the reference which i want to remain invisible to the user) from which you can select the one you want. *NOTE the query produces multiple results from which i want to use the drop down list to select the desired record*
b.php, echos the 3 visible fields using echo $_GET["form_name"];
this works fine but i want to be able to pass the Reference number for the record that has been selected from the drop down list seperatly to b.php so i can use that as an input into another table of the sql database.
i'm sure this is possible but i just can't see how to do it. Maybe involving a global variable containing the reference number?
The code i'm using for getting the results is below
[CODE=php]//display the results
echo "<form action=\"b.php\ " method=\"GET\"> ";
echo "<select name=\"TheClien t\">";
while($row = mssql_fetch_arr ay($client_resu lt))
{
echo "<option>" . $row["Surname"] . ", " . $row["Forenames"] . ($row["PartnerForenam es"] == NULL ? "" : " and " . $row["PartnerSurname "] . ", " . $row["PartnerForenam es"]) . " - " . $row["HomePostCo de"] . "</option>";
}
echo "</select>\n <input type=\"submit\" value=\"Submit\ " /></select></form>";[/CODE]
This is my first post and my first outing into the the world of web design and php so forgive me if i'm asking an obvious question.
i have 2 php pages at the moment.
a.php, calls a SQL query to retreive 4 fields (FirstName, Surname, PostCode and a Reference number) from a table based on an input from a form (Postcode). these fields are then displayed as a drop down menu (apart from the reference which i want to remain invisible to the user) from which you can select the one you want. *NOTE the query produces multiple results from which i want to use the drop down list to select the desired record*
b.php, echos the 3 visible fields using echo $_GET["form_name"];
this works fine but i want to be able to pass the Reference number for the record that has been selected from the drop down list seperatly to b.php so i can use that as an input into another table of the sql database.
i'm sure this is possible but i just can't see how to do it. Maybe involving a global variable containing the reference number?
The code i'm using for getting the results is below
[CODE=php]//display the results
echo "<form action=\"b.php\ " method=\"GET\"> ";
echo "<select name=\"TheClien t\">";
while($row = mssql_fetch_arr ay($client_resu lt))
{
echo "<option>" . $row["Surname"] . ", " . $row["Forenames"] . ($row["PartnerForenam es"] == NULL ? "" : " and " . $row["PartnerSurname "] . ", " . $row["PartnerForenam es"]) . " - " . $row["HomePostCo de"] . "</option>";
}
echo "</select>\n <input type=\"submit\" value=\"Submit\ " /></select></form>";[/CODE]
Comment