|
|
|
|
![]() ![]() |
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?
Reason for edit: add code tags
|
|
|
|
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 |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 11th October 2008 - 03:08 AM |