Jump to content
xisto Community
Sign in to follow this  

Getting Information From Submit Button I need to grab information from a submit button.

Recommended Posts

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

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.

Share this post

Link to post
Share on other sites

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

Edited by Stenno (see edit history)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.