Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Getting Information From Submit Button, I need to grab information from a submit button.
sonesay
post Aug 9 2007, 10:01 PM
Post #1


|||[ n00b King ]|||
*********

Group: [HOSTED]
Posts: 685
Joined: 20-June 07
From: Auckland
Member No.: 45,102



I basically have an array that uses characters as keys and has an integer value to it.


I have a loop that outputs the list in that array. For each entry I want a a button to remove it. The button will submit the form to another page which contains the script to be able to remove it from the array. The infomation for the keys name is used for the buttons name value. Im not sure how you go about grabbing this information once on the submitted page.

heres my code

CODE
echo("<form name='jobs' action='remove_job.php'>");
foreach($jobs as $job_class => $job_level) {

echo($job_class . " - " . $job_level . " <input type='submit' name='" . $job_class . "' value='Remove' /> <br />" );

}
echo("</form>");


when submitted to remove_job.php i get the key + value added onto the url. eg. remove_job.php?job_class=Remove

note: job_class on the url would be either class i chose to remove eg. warrior, paladin, ninja.... on yeah some of my job classes have spaces in them for example "White Mage" would be be a potential problem?

Notice from rvalkass:

Moved to PHP section.
Reason for edit: add code tags
Go to the top of the page
 
+Quote Post
Stenno
post Oct 2 2007, 05:42 AM
Post #2


Newbie [Level 1]
*

Group: [HOSTED]
Posts: 21
Joined: 29-September 07
Member No.: 50,836



K well first of all you posted in the wrong section, you have PHP code there and this is the HTML/XML section.Secondly you don't need ( if you make an echo statement. echo("</form>"); Better is: Echo "</form>";. Finally, if you want to grab info from an url you need the super global $_GET.

For example you have: index.php?age=7&blabla=nothing

echo $_GET['age']; // gives 7 as output
echo $_GET['blabla']; // gives nothing as output

hope this will help you out.

PS. could an admin or moderator move this too PHP section

This post has been edited by Stenno: Oct 2 2007, 05:43 AM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Delphi Tutorial - Change Your Start Button Caption(4)
  2. Psp Square Button Problem(12)
  3. Linking A Url To A Button(4)
  4. Button To Print Current Web Page(14)
  5. Radio Button(4)
  6. How To Create Java Button Or Frame(14)
  7. What Programming Languages Should I Choose?(17)
  8. Refresh Page After Back Button Hit(11)
  9. Is My Computer Overheated?(15)
  10. Carpentry Information(10)
  11. A New And Cheap Mmo May Be Coming. Would You Play It?(18)
  12. Free 20 Credits Up For Grab(31)
  13. Transfer Information Via Links With Php(2)
  14. Delaying The Time Until A Flash Button Can Be Pressed(3)
  15. Ftp Information For Qupis?(3)
  1. List Of Free Directories To Submit Your Websites(7)
  2. Frontpage Problem(0)
  3. Over 700 Ptc-sites Here With Information!(1)
  4. Need Information(2)
  5. Secure FTP information and assistance required(1)
  6. Finance Section Suggested(0)
  7. Cd Drive Eject Button Problem(3)
  8. Please Explain Me Mysql(4)
  9. How To Make Image Buttons Act As Submit Button(8)
  10. I Forgot My Log In Information(5)
  11. Idea For Using A Cron Job To Grab Daily Travian Map.sql Updates(3)
  12. Destination Address For "submit" Button(5)
  13. The Proper Method To Submit Tickets At Xistosupport(4)


 



- Lo-Fi Version Time is now: 11th October 2008 - 03:08 AM