Display Submit Button if a field is not emply

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mds840
Forum Newbie
Posts: 1
Joined: Fri Apr 14, 2006 2:36 pm

Display Submit Button if a field is not emply

Post by mds840 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I am trying to make a Submit button only display if there has been data entered into a field.


A simplified part of the form is below

Code: Select all

<form action="<? print $PHP_SELF; ?>" method="POST">
<input name="serialport" size="25" class="main"> <? print "<font size=-1>Serial Number/Portal ID:</font>";  ?>
<input type="submit" name="submitINPUT" value="Submit">
</form
I was trying to do something like the following, to have the button only display if there was data entered into the 'serialport' field

Code: Select all

<form action="<? print $PHP_SELF; ?>" method="POST">
<input name="serialport" size="25" class="main"> <? print "<font size=-1>Serial Number/Portal ID:</font>";  ?>

<?
if (isset($_REQUEST['serialport'])) {
	print "<input type=submit name=submitINPUT value=Submit>";
	}
?>

</form>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

PHP is processed on the server, not the browser. You will need Javascript to change the visibility or display settings of the button.
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post by BDKR »

"onChange" is your freind. Check also if there is (there should be) a visibility element for the submit button.
Post Reply