Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

HTML form - PHP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

HTML form - PHP

Postby php-punk » Wed Feb 05, 2003 11:56 am

right so far i have a HTML form (shown below)
How do i pass the variables of the form to another PHP page?

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Straight to the point - Guest Book</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<body text="#999999">
<form Name="Add" action=\"add.php" method="post">
<p><input name="name" type="text" Maxlength="25"></p>
<p><input name="email" type="text" maxlength="25"></p>
<P><b>Website</b>(if Available)</P>
<p><input name="website" type="text" maxlength"25"></p>
<p><b>Post For GuestBook</b></p>
    <textarea name="post" cols="30" rows="5" wrap="PHYSICAL"></textarea>
    <input name="submit" type="submit" value="Submit">
<input name="status" type="text">

New php-forum User
New php-forum User
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk

Postby Hurkle » Wed Feb 05, 2003 1:08 pm

Okay, you've got a basic html form setup, and you have described the 'action' and 'method' settings for the form.

If the action is "add.php", then, when this page is submitted, the web server will look for a script name 'add.php'.

Lets say you have such a script.

if you plase this code in it:

Code: Select all
echo "the entered name is:" ;


      echo $HTTP_POST_VARS['name'] . "<BR>";


    echo "No name value was passed from the form.<BR>";

you should see whatever was entered for the Name text box display.

Now , note a couple of things.. It's my understanding the using
should just about always work. I use
'cause it's shorter and works with my setup.
If 'register_globals' is set to on, you should be able to just refer to the name of the form element as if it were a variable.
i.e., if you had a form element name 'txt_user_name' on your form, then your script should be able to simply:

echo $txt_user_name;

I hope this helps

New php-forum User
New php-forum User
Posts: 36
Joined: Tue Jan 07, 2003 8:45 am
Location: Minnesota, USA

Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.