Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8475279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:51:03+00:00 2026-06-10T17:51:03+00:00

Ok I have a form with multiple submit buttons. The coding on my php

  • 0

Ok I have a form with multiple submit buttons.
The coding on my php file has a header with a url depending on which form was entered. My issue is when I submit the form( no matter which button I use) the window that pops up is not the url action assigned to that button but the php file itself. What am I doing wrong?

the form starts of like this so that you can see if I directed it correctly

<form method="post" action="http://gamerzacademy.com/foodCYO.php" target="_blank">
<input type="text" name="uid">
<input type="submit" name="Dish1" value="Dish1" onclick="
  this.disabled=true; 
  this.value='Gift Opened'; 
  document.FreeFoodForm.submit();">
<input type="submit" name="Dish2" value="Dish2" onclick="
  this.disabled=true; 
  this.value='Gift Opened'; 
  document.FreeFoodForm.submit();">

etc……

now the php file starts like this

<?php
if ($_REQUEST['Dish1'] == "Dish1") {
    header("Location: url1".urlencode($_POST['uid']));
}
else if ($_REQUEST['Dish2'] == "Dish2") {
    header("Location: url2".urlencode($_POST['uid']));
}
else if ($_REQUEST['Dish3'] == "Dish3") {
    header("Location: url3".urlencode($_POST['uid']));
}
.....etc
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:51:04+00:00Added an answer on June 10, 2026 at 5:51 pm

    You are posting the form through Javascript. The code doesn’t know which button was clicked, so the value of that button isn’t posted to the form. Therefor, your form cannot see which button was clicked. If you change the method to get, you will see which value do or do not get posted.

    I think you don’t need to post from Javascript at all. Just let the button do the posting. Only the name and value of the button that was clicked will be posted.

    B.t.w., you disable the button, presumably because you don’t want people to press the button twice, but in your setup they still can press any other button. I think it is wise to disable all of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to have multiple submit buttons. I have a form which creates an
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have multiple buttons in a form (all are type 'submit'). I would like
I have a form with multiple submit buttons. When one of those button is
I have a form with a simple text field and multiple submit buttons. When
Ok so I created a form that has one field but multiple submit buttons.
I have a form with multiple submit buttons and I'm listening for the 'submit'
I have a single form with multiple submit buttons that have same value. Example:
I have a form on an HTML page with multiple submit buttons that perform
I have quite a big form with multiple (over 100) submit buttons in it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.