Jul 25, 2008

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

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

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

sonesay
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.

 

 

 


Reply

Stenno
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

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : information submit button grab information submit button

  1. Stop Double Post/submit - (10)
  2. How To Insert Post Information Without A Form - How to insert post information without a form (1)
    I am relatively new with web design so I don't even know exactly what to ask here, but this
    can't be as hard as I am making it. I am a merchant and I want to pass just a few simple
    strings to the credit card processor: my merchant ID and pin, as well as a price and a few other
    simple variables. I want the merchant ID and pin to be invisible to the user. ...
  3. Editing Information In A Mysql Database And Deleting Rows - (5)
    I need help with a couple of things. First, I need to know how to retrieve information from a mysql
    database and edit it then re add it to the database. I also would like to know how to easily delete
    a mysql row. And I want this done without going to phpMyAdmin. Thanks for the help!...
  4. Form Dosn't Submit In Opera - Works in IE and FireFox (1)
    My form dosn't submit, it works in IE and FF, its validated HTML 4.01 and all, Code:
    /**********************************/ /** Post Topic :: EvilBoard **/
    /**********************************/ /* Session Start */ session_start(); /* Start Submit Script */
    if ( isset($_POST )) { header("Refresh: 0; redirect.php?posttopic");
    define("RELOADED","YES"); } /* End Submit Script */ /* Include File::Header.php */
    include("include/header.php"); echo " "; /* If Script can't find SESSION user_name */ if (
    !$_SESSION ) { /* Echo :: Forbiden */ echo '...
  5. Submit Restrictions - Is there anyway to bypass this on my localhost? (21)
    This can be considered my first php page after a long while, I did a little basic php years ago and
    I have totally forgotten most of it. But I have come up with a page; a simple calculator if you will
    with the essential add, subtract, multiply and divide functions. When I load the page on my
    localhost, I get this error However when I upload it to trap17, there is no problem, please
    take a look http://darran.trap17.com/php/Calculator/calculator.php I know this does not matter
    but I want to find out where I went wrong on my first php page. The code listing for ...
  6. Request: Php Submit Script With Save In Host - Get Picture form url (13)
    Hi all i want make one form whit php , when users submit there urls , then my site give one picture
    form url and save on my host ! how can do that ? thanks...
  7. Login / Authetication System Using Database - adding information (4)
    Is there any way to make such database where I can write like name and passwords.. Then make an
    login box, and when somebody trys to acces the login he needs to write the name and password.. Then
    it is verifyed if is there such name and password and if it is then acces the page.. I think there
    is posible something like that with MySQL (db).. but can anybody say me a script or way to make
    something like that? Alredy thanks.....
  8. About Whois System - searching websites' information (5)
    I want to install whois system in my website in which my visitors can search other websites'
    information. I want to have php source code of it. Is it free of charge? /ohmy.gif' border='0'
    style='vertical-align:middle' alt='ohmy.gif' /> What is the official website of WHOIS??! thx~
    /cool.gif' border='0' style='vertical-align:middle' alt='cool.gif' /> ...
  9. $_post Without A Form - Trying to post a value with using a submit button (9)
    Hey me again. Looks like im having trouble with php. THis time the solution should be easy but i
    just cant find it anywhere. I am trying to post a variable but i do not want to use a form because i
    hate the look of submit buttons for what i am using it for. I do not want to use javascript because
    of compatibility issues. If you know how to make a submit button look like a nomal text link that
    would work if you know how to send post data through an href that also would work. Or if you just
    know how to do it another way im open to suggestions. Thanks for all of your help...



Looking for information, submit, button, grab, information, submit, button,

Searching Video's for information, submit, button, grab, information, submit, button,
advertisement



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



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE