473,406 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Using multiple buttons with PHP

I am currently trying to make a four question quiz. Each question is on a new page. There will be a previous button and a next button to take the user to the previous and next question respectively. There will also be a save button to save the current answer selected for the questions so far. Finally, I will have a submit button that will submit all the answers of the quiz and give back a score. I have to use these buttons, and I have to have my page setup in this way. However, I am not sure how I should handle the buttons.

I currently have my HTML file as such which will send to a php file:

Expand|Select|Wrap|Line Numbers
  1. <h1>Music Quiz</h1>
  2.   <form action = "exam1.php" method = "post">
  3.     <p>
  4.       Which of the following composers were NOT famous during the
  5.       Renaissance period (1600-1750)? <br />
  6.       <select name = "questionOne">
  7.         <option></option>
  8.         <option value = "Guillaume Dufay">Guillaume Dufay</option>
  9.         <option value = "Josquin des Prez">Josquin des Prez</option>
  10.         <option value = "Henry Purcell">Henry Purcell</option>
  11.         <option value = "Palestrina">Palestrina</option>
  12.       </select>
  13.     </p>
  14.     <p>
  15.           <input type ="button" value="Previous Question" />
  16.       <input type = "submit" value = "Save" />
  17.           <input type = "submit" value = "Submit" />
  18.           <input type = "button" value = "Next Question" />
  19.     </p>
  20.   </form>
The PHP file can print the next question if the next question button was selected, etc. I should be able to handle everything in the php file. However, I don't know how to determine which buttons were pressed in my php file. How should I handle the next and previous buttons? How do I know which submit button was selected? Any help will be greatly appreciated.
Oct 13 '09 #1
3 2824
code green
1,726 Expert 1GB
Give them different names
Oct 13 '09 #2
How do you refer to the names in the PHP code? How can I make the PHP handle next and previous? Any ideas?
Oct 13 '09 #3
Dormilich
8,658 Expert Mod 8TB
@brian210
Expand|Select|Wrap|Line Numbers
  1. $_POST['name']
@brian210
save somewhere the sequence of the files and walk through that. (there are too many possibilities to list them all)
Oct 13 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt | last post by:
The ASP page has multiple buttons, and when the user clicks different buttons, it will submit the form data to different URLs. My first approach was to use BUTTON type, and triggers javascript...
2
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as...
8
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
7
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form...
5
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with...
1
by: favor08 | last post by:
I need help with a big project. I am struggle getting multiple option buttons and filters to work together. They need to be able to filter a subform. My first set of option buttons work fine all...
1
by: dzulai | last post by:
hello guys, im using VB6 to automate Access 2000 using opencurrentdatabase. basically, the VB part is just for login purposes and all other forms are in Access. i want to prevent the user from...
3
by: Andreas Wöckl | last post by:
HI Group! I have to programmatically create a user input form with various Checkbox and RadioButton lists - Beside every List I have to place an image button that is able to reset the...
1
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two...
2
by: 6afraidbecause789 | last post by:
Hi - Has anyone ever used toggle buttons to select items in a listbox? I'd like to put about 24 toggle buttons on an unbound form that select or deselect items in a multiple select listbox. I've...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.