Posted by Tim Streater on 03/27/07 14:14
In article <1174999392.257336.277940@b75g2000hsg.googlegroups.com>,
"elia" <joseph@pcl.ch> wrote:
> Hello,
>
> I use php and javascript on a form.
> My validate script doesn't work with radio button. What's wrong? I
> want to be sure that one of the button is press. M or F
>
> I get on my first page:
>
> <?php
> $Genre=$_POST['genre'];
> ?>
> <head>
> <script type="text/javascript">
> function verif_champs()
> {
>
> if(document.forml.Genre.value == "")
> {
> alert("Choose the gender!");
> document.forml.Reference.focus();
> return false;
> }
Where is the closing } for this function?
> </script>
> </head>
> <body>
> <form name="forml" method="post" onSubmit="return verif_champs()"
> action="test22.php" >
> <table>
> <tr><td>
> <?
> $checked[$_POST['Genre']]='checked="checked"';
> echo '<input type = "radio" name="Genre" value="F"
> '.$checked['F'].'/>';
> echo '<input type = "radio" name="Genre" value="M"
> '.$checked['M'].'/>';
> ?> <input type="submit"></td></tr>
> </table>
> </form>
>
> On my page 2:
>
> <?php
> $Genre=$_POST['Genre'];
> ?>
> <body>
> <table>
> <tr><td>
> <form name="form2" ACTION="test11.php" method="post">
> <? foreach ($_POST as $key=>$val)
> {
> echo '<input type = "hidden" name="'.htmlentities($key).'"
> value="'.htmlentities($val).'" />';
> }
> ?>
> <? echo $Genre ?>
> <input type="submit" name="Submit2" value="Back" />
> </form>
> </td></tr></table>
> </body>
>
> Thanks a lot. Pascal
-- tim
Navigation:
[Reply to this message]
|