Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 15th, 2003, 05:59 AM
Dai Dai is offline
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forms and variables

I've started to teach my self php again this time seriously but I've got one small proble and that is

that when I pass a variable from a form to a nother script (doesn't matter whether it's POSTor GET)

it doesn't print in the browser. (see code below) I've checked phpinfo and all seems ok to me

rechecked the script in the book and my scripts and everything seems ok so I'm stumped! Any

suggestions would be appreciated (using foxserv for apache, php etc and maguma studio as the

editor)

<html>
<head>
<title>Form Results</title>
</head>
<body>
<FORM ACTION="handleform.php" METHOD="POST">
First Name:<input type="text" name="firstname" size="20"><br>
Last Name:<input type="text" name="lastname" size="20"><br>
E-mail Address:<input type="text" name="email" size="20"><br>
Comments:<BR>
<textarea name="comments" rows=5 cols=40 wrap="on"></textarea><BR>
<input type="submit" value="SUBMIT" name="submit">
</FORM>
</body>
</html>

<html>
<head>
       <title>Title here!</title>
</head>
<body>
<?php
/* This page recieves and handles the data generated by "form.html"*/

echo "Your first name is $firstname.<br>";
echo "Your last name is $lastname.<br>";
echo "Your E-mail address is $email.<br>";
echo "This is what you had to say:<br>";
echo "$comments";

?>
</body>
</html>

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>
</head>
<body>
<FORM ACTION="text.php" METHOD="GET">
Who is your favourite author:<BR>
<input type="text" name="author" size="20">
<br>
<br>
<input type="submit" value="SUBMIT">
</FORM>
</body>
</html>

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>
</head>
<body>
Your favourite author is:
<?php
echo "$author";
?>
</body>
</html>
;):)

What ever makes life easy
__________________
What ever makes life easy
 
Old June 15th, 2003, 06:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

What is the value of register_globals variable into
your php.ini file?

...but the Soon is eclipsed by the Moon
 
Old June 15th, 2003, 07:02 AM
Dai Dai is offline
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

register_globals = Off

I'ts set to off

What ever makes life easy
 
Old June 15th, 2003, 07:09 AM
Dai Dai is offline
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've set register_globals to on and it's working ok now thanks.
:D;)

What ever makes life easy
 
Old June 19th, 2003, 02:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You're much better off NOT setting register_globals to ON. I know it makes coding so much easier but there are lots of security risks involved.

read my FAQ about it:
 http://p2p.wrox.com/archive/beginnin...2002-11/17.asp


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
accessin variables from various forms anandthecoolest C# 2005 2 March 8th, 2007 03:18 AM
Problem With variables and forms marcrock Classic ASP Databases 1 November 8th, 2005 02:02 PM
Simple 'passing variables between forms' issue... overture C# 4 October 14th, 2005 02:30 PM
Passing variables between forms arcuza General .NET 1 July 11th, 2005 09:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.