Page 1 of 1

combo box to page

Posted: Fri Sep 30, 2005 5:42 am
by rami
i have combobox as follows

Code: Select all

<form action="disstudents.php" method="POST"> 
<select name="user_id"><option >select one</option>
<?php
require_once ('../mysql_connect1.php');
$query = "SELECT user_id,name  from students";		
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
	echo '<option value="'.$row['user_id'].'">'.$row['name'].'</option>';
}
mysql_close();
?>
</select>
<input type="submit" value="Show Data!"> 
</form>
i have disstudents.php which displays students in database as uid passes ie
localhost/disstudnets.php?uid=10;
with link that page is working fine
but what i want to do is from that combo box pass that uid to disstudents.php but it is not working
how can i do it
i want to open page(disstudents.php) taking uid from combo box which displays studnets name..

now it says missiong uid ..in disstudents.php

any help
thanks...
rami

Posted: Fri Sep 30, 2005 5:47 am
by ruchit
replacing this

Code: Select all

<form action="disstudents.php" method="POST">
with

Code: Select all

<form action="disstudents.php" method="GET">
would do it for you

Posted: Fri Sep 30, 2005 5:55 am
by Jenk
Or even better solution, use $_POST['uid'] instead of $_GET['uid'] on the receiving page :)

(or use $_REQUEST which does both - and cookies aswell, but that is semi-irrelevant for now)

Posted: Sat Oct 01, 2005 3:45 am
by rami
Jenk wrote:Or even better solution, use $_POST['uid'] instead of $_GET['uid'] on the receiving page :)

(or use $_REQUEST which does both - and cookies aswell, but that is semi-irrelevant for now)
Thanks my RUCHIT
i must have given second thought in it....

but mr jenk answer is not quite clear to me....

Mr ruchit ...
i have been searching for this code from quite some time now may be you can help me i feel so.
may be you can give me 5 minutes...

i have table batch(batch_id,program)
i made combo box as
batch
science2000
science2001
science2002

i have another one table students...
students(user_id,name,batch_id,program,address)

what is want is went some body clicks at a option on the first combo ie batch ...
the next page should dispaly combo box with students name in that batch(only)

(next i can do myself
displaying data about selected students from above answers and code)

my problem is sending id from one combo box to another combo....

i feel that it can be made by modifying some parts from above codes so please copy it paste it and make changes...

may be 5 minutes....

really thanks for help
any body can do ...
i have been looking for it from quite some time now
so any help
thanks