Author Topic: Making Forms set Variables  (Read 1645 times)

0 Members and 1 Guest are viewing this topic.

Offline !!!!!Topic starter

  • Enthusiast
  • Posts: 68
    • View Profile
Making Forms set Variables
« on: May 16, 2007, 04:03:31 PM »
A pretty simple question: How do I make HTML forms set Variables? And... How do I make those set variables set in a cookie?

Offline chigley

  • Devotee
  • Posts: 957
  • Gender: Male
  • PHP 5.2.1 ¦ mySQL 4.1.21 ¦ Apache 1.3.37
    • View Profile
Re: Making Forms set Variables
« Reply #1 on: May 16, 2007, 04:07:13 PM »
Make a form like this, method being either POST or GET, and name all of your inputs.

Code: [Select]
<form action="action.php" method="post">
 <input type="text" name="name" />
<form>

Then use this in action.php:

Code: [Select]
<?php

$name 
$_POST["name"]; // If you used POST
$name $_GET["name"]; // If you used GET
$name $_REQUEST["name"]; // If you want to use both

?>

:)

Offline !!!!!Topic starter

  • Enthusiast
  • Posts: 68
    • View Profile
Re: Making Forms set Variables
« Reply #2 on: May 16, 2007, 04:55:13 PM »
Make a form like this, method being either POST or GET, and name all of your inputs.

Code: [Select]
<form action="action.php" method="post">
 <input type="text" name="name" />
<form>

Then use this in action.php:

Code: [Select]
<?php

$name 
$_POST["name"]; // If you used POST
$name $_GET["name"]; // If you used GET
$name $_REQUEST["name"]; // If you want to use both

?>

:)
Thanks... Is there a way to make the cookie work all across the website so that... If they haven't set the cookie yet they can fill out a form, it sends them to a Redirect page saying 'Thanks for filling out the form (blah blah blah)' then redirecting them to another page with the variables from the forms they filled out still being in use?

Offline !!!!!Topic starter

  • Enthusiast
  • Posts: 68
    • View Profile
Re: Making Forms set Variables
« Reply #3 on: May 16, 2007, 07:33:47 PM »
Does anyone please have the anwer?