/    Sign up×
Community /Pin to ProfileBookmark

SUBMIT Button does not work

I have submit button:
<input type=”submit” name=”request”>

and script
if (isset($_POST[‘request’])) { …

it works if there is type submit but if I would like to
show image,
e.g. <input type=”image” name=”request” src=”images/submit.gif”>
action is not performed. Do you know what is wrong?

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@bokehSep 15.2005 — yes! It sends coordinates if there is an image. Use a field name from one of your other input fields.
Copy linkTweet thisAlerts:
@toplisekauthorSep 15.2005 — Please inform me what do you mean:

Use a field name from one of your other input fields.

should I change name="request"

i do not understand,

sorry
Copy linkTweet thisAlerts:
@bokehSep 15.2005 — Your form must have other inputs apart from the button. If you just want to check the form was submitted just use another field name. For example if your form has a field called name to check the form was submitted you could use if(isset($_POST['name'])). If you are still stuck post the form.
Copy linkTweet thisAlerts:
@SpectreReturnsSep 16.2005 — Or include a hidden input called "action" and check that.
Copy linkTweet thisAlerts:
@toplisekauthorSep 16.2005 — I have the following code and it does not work. Please help me what should I changed?

if (isset($_POST['request'])) {...

$example->add_text_field("First_name", $_POST['fname'], "text", "y", 30);
$example->add_text_field("Last_name", $_POST['lname'], "text", "y", 30);



and form :

<form action="<?php echo $PHP_SELF; ?>" method="post" >

<?php echo (isset($error)) ? $error : "&nbsp;" ?></p>

<TABLE BORDER="0" bgcolor="#E8E8E8" width="550" HEIGHT="24" >

<TR>

<TD CLASS="NAV4"></TD></TR>

<TR>

<TD CLASS="NAV4"></TD></TR>

</TABLE>

<TABLE BORDER="0" bgcolor="#E8E8E8" width="550" HEIGHT="24" >

<TR>

<TD CLASS="NAV4">My First Name:</TD>

<TD CLASS="NAV4">My Last Name:</TD>

</TR>

<TR>

<TD><input name="fname" maxlength="30"size="20">

<TD><input name="lname" maxlength="30"size="20" ></TD>

</TR>

<TR>

<TABLE BORDER="0" bgcolor="#E8E8E8" width="550">

<TR>

<TD CLASS="NAV4">

<input type="image" name="request" src="images/submit.gif">

</TD>

</TR>
Copy linkTweet thisAlerts:
@bokehSep 16.2005 — change this:

if (isset($_POST['request'])) { ...

to:

if (isset($_
POST['fname'])) { ...
Copy linkTweet thisAlerts:
@toplisekauthorSep 16.2005 — It works,

thanks. Do you know why if script does not work if there is

if (isset($_POST['request']))? What's the trick? It should be result true.
Copy linkTweet thisAlerts:
@bokehSep 16.2005 — If you read my first post above it contains the answer. The script used to work but you changed from a button to an image. This in turn changed the name of the $_POST['request'] variable to something with coordinates. If you can't understand this print the post array and you will see.

[code=php]print_r($_POST);[/code]
Copy linkTweet thisAlerts:
@toplisekauthorSep 17.2005 — thanks, now I understand. you are very helpful
×

Success!

Help @toplisek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...