Jump to content


PHP form


4 replies to this topic

#1 baggyn

    Young Padawan

  • Members
  • Pip
  • 28 posts
  • Location:Top secret
  • Interests:COMPUTER

Posted 29 May 2005 - 03:09 AM

hi

i've jst started to learn PHP and i have created a comment form which emails me all the inputted date e.g name e-mail ect but i want ot know how do you make it so that when the submit button is pressed you are taken to another page.

can someone please help me. :D

#2 MaRmAR

    Young Padawan

  • Members
  • Pip
  • 18 posts
  • Location:Slovakia

Posted 29 May 2005 - 04:13 AM

Hi. That's easy. Check this code:

<form action="next_script.php" method="post">
  <input type="text" name="usernname" />
  <input type="submit" value="OK" />
</form>

This form will send a variable "username" to script "next_script.php" using POST. POST means that you do not see the variables and it is more secure; if you use GET, you'll see them, e.g.

next_script.php?username=joe

I prefer POST.

#3 baggyn

    Young Padawan

  • Members
  • Pip
  • 28 posts
  • Location:Top secret
  • Interests:COMPUTER

Posted 29 May 2005 - 08:41 AM

Yea i no that but i wnt is so when they click the submit buttin they get transfered to another page

#4 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 29 May 2005 - 11:48 AM

he just told you how. next_script.php would be the page that your form would POST to. since the form action is next_script.php when the submit button named "OK" is hit it would take you to next_script.php.

<form action="next_script.php" method="post">

and the rest would be this. like MaRmAR said above...

 <input type="text" name="usernname" />
 <input type="submit" value="OK" />
</form>


#5 baggyn

    Young Padawan

  • Members
  • Pip
  • 28 posts
  • Location:Top secret
  • Interests:COMPUTER

Posted 29 May 2005 - 03:12 PM

sorry i,m new tp PHP and im still learning the basics

cheers :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users