Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Problem with dual buttons on a form

Guest
Apr 05, 2006 Apr 05, 2006

Copy link to clipboard

Copied

Hello -

I have a single form with two buttons, currently named 'Button1' and 'Button2'. Both buttons lead through the default DW/php code to update database records (in MySQL), but I want the page redirect after updating to be determined by which button was pushed.

I am using $_GET['ButtonName'] to direct action based on which button was used to submit the form. Unfortunately, I can't seem to redirect the page where I want.

The code I am using is:

=======
if (isset($_GET['Button1'])) {
$updateGoTo = "edit_onepage.php";
} else {
$updateGoTo = "account.php";
}
========

If the user submits using Button1, I want them forwarded to "edit_onepage.php". If he submits using Button2, I want him forwarded to "account.php". Unfortunately, no matter how I fiddle with this code, the form is always forwarding to "account.php", regardless of which button is pushed.

Can anyone see what I am missing here? Thanks in advance for your advice.
TOPICS
Server side applications

Views

303
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Apr 05, 2006 Apr 05, 2006
Oops! Found my own mistake. It works if I retrive the button information with '$_POST', not '$_GET'. I'll leave this up in case anyone else has a similar porblem.

Votes

Translate
Guest
Apr 05, 2006 Apr 05, 2006

Copy link to clipboard

Copied

Oops! Found my own mistake. It works if I retrive the button information with '$_POST', not '$_GET'. I'll leave this up in case anyone else has a similar porblem.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2006 Apr 17, 2006

Copy link to clipboard

Copied

LATEST
I am having the same problem, but I am using VB Script on an Asp page. How can I tell which button is pressed in this scenario?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines