Jump to content

Archived

This topic is now archived and is closed to further replies.

chris4321

storing variables from a form within same page

Need help storing variables from post form  

1 member has voted

  1. 1. Need help storing variables from post form

    • ghfg
      1
    • fghfg
      0


Recommended Posts

I have a form, when i hit sumbit it shows the value of the textbox, now i want to use the value of the textbox in other statements within my php page, without retyping it. I had a look but i cant get a clear answer. Can anyone help me

Share this post


Link to post
Share on other sites
you could use javascript to grab the contents of the textbox if it doesnt need to be used server side... or you could store it in a file, or preserve the $_POST var set by it...

Share this post


Link to post
Share on other sites
Yes like Corbin had said if you want to carry it over and store it in a database or compare the information you would use the following:

Say this is your form on your 'text.html' file page.  My example is a userName.

<input type="text" name="userName" />

On the page that your trying to put it into a variable you would have it as

$userName = $_POST['userName'];

It doesn't have to necessarily be userName you can make it whatever you want username, text, whatever you would like.

Share this post


Link to post
Share on other sites

×

Important Information

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.