/    Sign up×
Community /Pin to ProfileBookmark

php submission buttons

I have 3 submit buttons to do different operations on my php form. Looks like I can have only one submission button a form. Does any body know how can I Differentiate between the buttons? For example one button is:

[CODE]<input type=”submit” name=”btnEdit” value=”Edit”>[/CODE]

I tried the following code but that didn’t work. Hope someone more experiences than me can help me.

[CODE]If ($_POST[“btnEdit”] = “Edit”);
…..
[/CODE]

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 19.2005 — [i]Originally posted by black912star [/i]

[B]I tried the following code but that didn't work. Hope someone more experiences than me can help me.

[CODE]If ($_POST["btnEdit"] = "Edit");
.....
[/CODE]
[/B][/QUOTE]

Perhaps a syntax issue? No capitalization of the word "if", single equal sign is wrong, and semicolon is wrong for the end of the if condition line. That should be either an opening brace or a colon.
[code=php]
if ($_POST["btnEdit"] == "Edit"):
...
endif;
[/code]
Copy linkTweet thisAlerts:
@gameguy43Mar 19.2005 — i would change the type on the buttons to "button" instead of "submit". Try that other dude's fixed and this one and see what happens
Copy linkTweet thisAlerts:
@phpnoviceMar 20.2005 — [i]Originally posted by gameguy43 [/i]

[B]i would change the type on the buttons to "button" instead of "submit".[/B][/QUOTE]

The problem with using the "button" type is that the form won't sumbit with it and, then, you have to use JavaScript to get the form to submit. If JavaScript is disabled, then your page is broken.
×

Success!

Help @black912star 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...