The error is
Notice: Undefined variable: row in C:\xampp\htdocs\index1\showtest.php on line 73
Looks as though some of the script is missing?
Please enclose the script starting and finishing with three backticks on their own line:
// try adding the following line to view the $row[] contents:
echo '<pre>'; print_r( $row ); echo '</pre>';
// your script
";
}
else
{
echo "$row[1]";
}
}
?>
Yes indeed. Using three backticks before and after
<form action="showtest.php" method="post">
<table width="58%" align="Center">
<tr>
<td><br><select name="subid" >
<?php
extract($_GET);
$rs1=mysql_query("select * from mst_subject");
while($row=mysql_fetch_array($rs1))
{
if($row[0]==$subid)
{
echo "<option value='$row[0]' selected>$row[1]</option>";
}
else
{
echo "<option value='$row[0]'>$row[1]</option>";
}
}
?></select>
</td></tr>
<tr>
<td><br><input type="submit" name="submit" value="Add" ></td>
</tr>
</table>
</form>
So what code is on line 73?
My bet is the echo in the else.
The problem line (for starters) should be
while($row=mysqli_fetch_row($rs1))
the code in line 73 is:
echo '<pre>'; print_r( $row ); echo '</pre>';
makes no sense to give a guess for you not providing an comprehensible code.
Problem is solved…anyway thanks
Can Anyone make me understand…Why if($row[0]==$subid) is used in the above query?..what is its work?
What parameters are in the GET array?
The script is still not displaying correctly,
Please enclose the script starting and finishing with three backticks on their own line:
It’s there so that when the list of options is displayed, it will add the “selected” option to the one that’s passed in as the current selected option.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.