MySQL Forums
Forum List  »  PHP

Validate a radiobutton and an input text to a while-sql-query?
Posted by: Emil Kotztropf
Date: January 27, 2014 11:46AM

Hy,

I would like to refer to an entry in a SQL table with some radio buttons. There will be 5 or more radio buttons for each entry and one input-type="text" which needs to be validated too. If it is useful maybe with a little bit javascript.

Validation means: The reference between the radio buttons and the input text field to the while query which is the primarykey "id" ($row->id). By the way.

The "validate.php" should validate a chosen radio button and the entered text in the input text. I have no idea how to validate them... Please help.

seesomething.php
<?php
require("connect.php");
require("validate.php");

$query = mysql_query("SELECT id, ... FROM table ")
?>
<form action="" method="post">

<?php
while($row = msql_fetch_object($query)){
echo "
<table>
<tr>
<td>$row->id</td>
<td><input type='radio' name='validateme' value='1'></td>
<td><input type='radio' name='validateme' value='2'></td>
<td><input type='radio' name='validateme' value='3'></td>
<td><input type='radio' name='validateme' value='4'></td>
<td><input type='radio' name='validateme' value='5'></td>
<td><input type='text' name='validateme_too'></td>
</tr>
</table>";
}
?>

<table>
<tr>
<td><input type="submit" name="submit"></td>
</tr>
</table>

</form>

Options: ReplyQuote


Subject
Written By
Posted
Validate a radiobutton and an input text to a while-sql-query?
January 27, 2014 11:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.