开发者

Hidden Form Field Not Storing Variable

I have the following form:

form

<?php
echo '<td><form action="episodesdelete.php" method="POST">';
echo '<input type="hidden" name="epid" value="'.$row['epid'].'">';
echo '<input type="submit" value="Delete"></form></td>';
?>

Which is part of a function to display MySQL data in an HTML table.

For some reason, when i look at开发者_StackOverflow中文版 the hidden field with FireBug, it is empty. Could you please advise due to what that can be?


Where is $row assigned its value?

A very common mistake is to not check for failed queries. Make sure to check every query execution for errors, like so:

$result = mysql_query($query_text) or die("Error running query " . mysql_error());

If that line gets passed (the query succeeds), make sure that $row is getting assigned a valid value (by a function like mysql_fetch_array perhaps?).

And, if that checks out, run the query yourself from the command line to verify that the results are what you expect (and that the query is not actually returning an empty string).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜