You are here: Re: validate button radio in form « PHP Programming Language « IT news, forums, messages
Re: validate button radio in form

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация