0

Hello Friends,

i have created a page, here a sql query retrieve students name from database and put these values in drop down options.

now i want, i select a value from drop down and send it ot another page. but it is not working. on my next page nothing received. it is showing blank.

please help to do this.

thanks

Gajendra

My form code is:

include("configuration.php");

$result = mysql_query("SELECT * FROM 8a");

echo "<form action='marksheet.php' method='post'>";

echo "<font color='#FFFFFF'>Selece Student: <select name='st'>";

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

  echo "<option value='".$row['1']."'>".$row['1']."</option>"; 

   }
echo "</select>";

echo "<input type='submit' value='Print Marksheet'/>";
echo "</form>";



?>
3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by Biiim
0

in the marksheet.php page you can access selected student by following line of code, in the begnining of the page

echo $_POST['st'];

or you dump post array to check what is posted like

echo "<pre>";
print_r($_POST);
echo "</pre>";

Edited by urtrivedi: -

0

echo "<option value='".$row['1']."'>".$row['1']."</option>";

the array index isn't a string its a integar:

 echo "<option value='".$row[1]."'>".$row[1]."</option>";

also just in case, index starts at 0 so the first column will be $row[0]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.