help with passing varable to next page, please!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rponchek
Forum Newbie
Posts: 7
Joined: Sat Dec 28, 2002 10:33 pm

help with passing varable to next page, please!!

Post by rponchek »

I am new to php, however, I am trying to make a series of pages work like this.... I have a picklist which links to a MySQL database for displaying certain results. of those results you can link to an "edit" screen where info can be updated in the database. I want to be able to return to the same selected list on the picklist when returning to the index after editing an entry. I have been trying to set a variable to session, however I am pretty sure the code used to develop the picklist cancels the variable... please help... I am including code I used for the picklist... and how I called variable...

<form method="post" action="<? echo $PHP_SELF; ?>">
<table border=0>
<tr>
<td>
<p>
<b>View Hospital:</b><br>
<select name="CatView">

<option value=0>Select


<?

// Here we generate the category picklist by running a subquery
// on a separate table and building a select widget one line at a time.



$typequery = "select * from type";
$typeresult = mysql_query($typequery) or die ( mysql_error() );

while ($row = mysql_fetch_array($typeresult, MYSQL_ASSOC))
{
$type_ID = $row["type_ID"];
$typename = $row["typename"];
echo "<option value=\"$type_ID\"";

// We also want the picklist to display the currently selected category,
// so we print "selected" when $CatView==$type_ID.
// Note the use of == rather = . This is a comparison, not an assignment!

if ($type_ID==$CatView) {
echo " selected";
}
echo ">$typename\n ";}

session_start();
session_register ("currenthosp");
$currenthosp = $CatView ;


?>




?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

does viewtopic.php?t=511 contain the answer to your question?
Post Reply