Submit button not appearing on the screen
| From: | sannec27 at eng dot uab dot edu | Date: | Fri, 27 Oct 2000 02:44:04 +0000 |
| Subject: | Submit button not appearing on the screen | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22251@lists.php.net to get a copy of this message | ||
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