Re: Submit button not appearing on the screen
| From: | Thomas Martins | Date: | Fri, 27 Oct 2000 09:03:12 +0000 |
| Subject: | Re: Submit button not appearing on the screen | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22298@lists.php.net to get a copy of this message | ||
Hi There
Your problem lies with the last php command...exit;
PHP parses the code until it sees the exit command, and then
exits...stop parsing...in other words, your button html code is not send
to the client.
Load your page, and do a view souce, you won't see your button. Remove
the exit, and all should work fine...
sannec27@eng.uab.edu wrote:
>
> Hi all,
>
> i am pretty new to PHP world, sorry if it is very dumb question. I am having
> a form to collect the users first name and age. My intention is to give a
> javascript alert if the user didn't fill any of the fields. If the user
> fills both the fields this file is going to call another file
> (submitform.php) and confirms the user. So i am having two text fields and
> one submit button my page. I don't understand whether the problem is in php
> script or function calling, somehow the submit button is not appearing on my
> page and desired action is not taking place.
> Here is my code.
>
> ------------------------------
> <html>
> <head>
> <title>User Info Form</title>
> </head>
> <body>
> <form action=submitform.php method=get>
> First Name: <input type=text name=fn size=25 maxlength=25>
> <p>
> Age : <input type=text name=age size=5 maxlenght=25>
> <p>
> <?php
> if (!$fn || !$age) {
> echo "<script language =\"javascript\">";
> function submitit(){
> echo "alert(\"Please fill in all the fields\");";
> }
> echo "</script>";
> exit;
> }
> ?>
> <input type=submit value="Submit Details" onclick=submitit()>
> </form>
> </body>
> <html>
> -------------------------
>
> many thanks
> Chakravarthy K Sannedhi
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net