combo
apple
orage
....
when apple is clicked the things in row of apple should display in another page
i have made this
combo.php
Code: Select all
<form action="myscript.php" method="POST">
<select name="program"><option >select one</option>
<?php
require_once ('../mysql_connect1.php');
$query = "SELECT batch_id,program from batch";
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo '<option value="'.$row['batch_id'].'">'.$row['program'].'</option>';
}
mysql_close();
?>
</select>
<input type="submit" value="Show Data!">
</form>Code: Select all
<?php
require_once ('../mysql_connect.php');
$id = $_POST['batch_id'];
$result = mysql_query("select * from batch where id = $id");
if (!$result)
die(mysql_error()); // this *should* not happen - but it is safe to look for SQL-Errors
if (!mysql_num_rows($result))
die("Oops! No Entry found for $id");
$row = mysql_fetch_assoc($result);
foreach($row as $key => $value)
echo "$key = $value<br \>\n";
?>whats is correct code where is the error..
i think the data from combo.php is not being send to myscript.php
please help..
rami