Jump to content


storing variables from a form within same page

  • Please log in to reply
2 replies to this topic

Poll: Need help storing variables from post form (1 member(s) have cast votes)

Need help storing variables from post form

  1. ghfg (1 votes [100.00%])

    Percentage of vote: 100.00%

  2. fghfg (0 votes [0.00%])

    Percentage of vote: 0.00%

Vote Guests cannot vote

#1 chris4321

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 07 October 2006 - 01:37 AM

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

#2 corbin

  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 07 October 2006 - 01:38 AM

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...
Why doesn't anyone ever say hi, hey, or whad up world?

#3 ImTomScott

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 07 October 2006 - 02:27 AM

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users