RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3643 | Replies: 4
Reply
Join Date: Jan 2005
Posts: 1
Reputation: crippz is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
crippz crippz is offline Offline
Newbie Poster

receiving data from a form in PHP?

  #1  
Jan 22nd, 2005
hi

i've just started learning PHP.

i have downloaded phptriad 4.1 so that i can use php without uploading it to server.

For my feedback html file, i put:
<html>
<head>
<title>TAEKWONDO WEBSITE - Membership Form</title>
</head>
<body>
<font face="arial" size="4">
<p align="center"><big>Membership Form</big></p>
Please Fill In Your Details And Click Submit:
<br />
<fieldset><legend align="center">Personal Information</legend>

<form action="membership_form2.php" method="get">

First Name:<input type="text" name="name" size="10"/>
</fieldset>
</form>
</body>
</html>

FOR MY PHP FILE I PUT:
<html>

<head>

<title>TAEKWONDO WEBSITE - Membership Form</title>

</head>

<body>
<?php
ini_set ('display_errors',1);
register_globals
print "{$HTTP_GET_VARS['name']}";
?>
</body>
</html>

SAVED PHP AS membership_form2.php & put all in same directory.

When i test it by filling in form & submit, Nothing appears its just a blank page?????????

any ideas?

mark

:eek:
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Location: San Francisco, CA
Posts: 338
Reputation: paradox814 is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Re: receiving data from a form in PHP?

  #2  
Jan 22nd, 2005
maybe try this instead:
echo $_GET['name'];

instead of
<html>

<head>

<title>TAEKWONDO WEBSITE - Membership Form</title>

</head>

<body>
<?php
ini_set ('display_errors',1);
//globals are usually on by default
echo $_GET['name'];
?>
</body>
</html>

depending on what version of php you are usign you may just be able to use $_GET instead of $HTTP_GET_VARS
i sure hope that works!
Reply With Quote  
Join Date: Jan 2005
Location: "New York New York it's a hell of a town"
Posts: 3
Reputation: hise@ledcity.net is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hise@ledcity.net's Avatar
hise@ledcity.net hise@ledcity.net is offline Offline
Newbie Poster

Re: receiving data from a form in PHP?

  #3  
Jan 23rd, 2005
Crippz:

Obtaining POST and GET vars in PHP is pretty easy.

Try replacing:

ini_set ('display_errors',1);
register_globals
print "{$HTTP_GET_VARS['name']}";

with

print($GLOBALS['HTTP_GET_VARS']['name']);

If that does work, just for kicks, try this as well:

print($name);

Good luck!


Originally Posted by crippz
hi

i've just started learning PHP.

i have downloaded phptriad 4.1 so that i can use php without uploading it to server.

For my feedback html file, i put:
<html>
<head>
<title>TAEKWONDO WEBSITE - Membership Form</title>
</head>
<body>
<font face="arial" size="4">
<p align="center"><big>Membership Form</big></p>
Please Fill In Your Details And Click Submit:
<br />
<fieldset><legend align="center">Personal Information</legend>

<form action="membership_form2.php" method="get">

First Name:<input type="text" name="name" size="10"/>
</fieldset>
</form>
</body>
</html>

FOR MY PHP FILE I PUT:
<html>

<head>

<title>TAEKWONDO WEBSITE - Membership Form</title>

</head>

<body>
<?php
ini_set ('display_errors',1);
register_globals
print "{$HTTP_GET_VARS['name']}";
?>
</body>
</html>

SAVED PHP AS membership_form2.php & put all in same directory.

When i test it by filling in form & submit, Nothing appears its just a blank page?????????

any ideas?

mark

:eek:
Reply With Quote  
Join Date: Apr 2006
Posts: 5
Reputation: luccig is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
luccig luccig is offline Offline
Newbie Poster

Re: receiving data from a form in PHP?

  #4  
Apr 28th, 2006
You need a submit button on your form..

something like <input type=submit value="Send it">
Reply With Quote  
Join Date: Aug 2004
Location: North Carolina
Posts: 27
Reputation: Banderson is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
Banderson's Avatar
Banderson Banderson is offline Offline
Light Poster

Solution Re: receiving data from a form in PHP?

  #5  
May 4th, 2006
Your Form Below:

[html]
<html>
<head>
<title>TAEKWONDO WEBSITE - Membership Form</title>
</head>
<body>
<font face="arial" size="4">
<p align="center"><big>Membership Form</big></p>
Please Fill In Your Details And Click Submit:
<br />
<fieldset><legend align="center">Personal Information</legend>
<form action="membership_form2.php" method="get">
First Name:<input type="text" name="name" size="10"/>
</fieldset>
<input type="submit" name ="submit" value="Send">
</form>
</body>
</html>

[/html]



membership_form2.php Below:

[php]
<html>
<head>
<title>TAEKWONDO WEBSITE - Membership Form</title>
</head>
<body>

<?php

error_reporting(1); // Error reporting set @ 1

/* I submitted a code snippet at this forum concerning register_globals = off >> You can read it at : http://www.daniweb.com/code/snippet484.html */

if (!ini_get('register_globals')) {
$superglobals = array($_SERVER, $_ENV,
$_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) {
array_unshift($superglobals, $_SESSION);
}
foreach ($superglobals as $superglobal) {
extract($superglobal, EXTR_SKIP);
}
ini_set('register_globals', true);
}
print "$name";
?>
</body>
</html>

[/php]
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 8:33 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC