March 5th, 2004, 01:48 AM
|
#1 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Gold Coast,Australia
Posts: 2,475
| newbi php help
Hello all,
I have started following this PHP tutorial at Webmonkey
I have copied the code on that page exactly, and well it dosent work.
The form data that i type in will not show up on the next page.
I am useing apache 2.0.48 with PHP 4.3.4. if it matters at all. |
| |
March 7th, 2004, 07:37 PM
|
#2 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Gold Coast,Australia
Posts: 2,475
|
Bump, I still have know idea.
__________________
(\(\
(o'.')
(,,)('')('')
|
| |
March 7th, 2004, 08:02 PM
|
#3 (permalink)
| | dword to your moms
Join Date: Oct 2001 Location: ~/
Posts: 3,195
|
Does anything show?
Post your actual code. |
| |
March 7th, 2004, 08:10 PM
|
#4 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Gold Coast,Australia
Posts: 2,475
|
Ok here is the HTML page which collects the data Code: <html>
<head>
<title>My form</title>
</head>
<body>
<form action="bad_words.php" method="get">
My name is:
<br> <input type="text" name="yname">
<p>
My favorite dirty word is:
<br> <input type="text" name="fword">
</p>
<input type="submit" name="submit" value="Enter my data!">
</form>
</body>
</html> And here is the code of the page it goes to Code: <html>
<head>
<title>Perv!</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>
Hi <?php print $YourName; ?>
<p>
You like the word <b> <?php print $FavoriteWord; ?> !?! </b>
<p>You oughta be ashamed of yourself!
</body>
</html>
This is all the php page spits out:
Hi
You like the word !?!
You oughta be ashamed of yourself! |
| |
March 7th, 2004, 08:27 PM
|
#5 (permalink)
| | dword to your moms
Join Date: Oct 2001 Location: ~/
Posts: 3,195
|
Just a few thoughts...
1.) Why are you using get as a form method?
2.) You have not defined those variables so they are printing what they hold, nothing.
Depending on how you have your webserver configured you may be able to access variables directly defined as so, but using consistent names..... Code: <input type="text" name="yname"> Code: <?php print $YourName; ?> See how those 2 dont coincide?
You may need to use $_POST[varname] and $_GET[varname] depending on your configuration.
You really would be better off just writing this from the start and learning a quick bit about using POST, GET, and forms in PHP. It is all fairly simple.
<form action=page.php method='POST'>
<input type=bleh name=newname>
</form>
on submit....
print "This is my variable --> $_POST[newname]\n";
This will post the form data in newname and (depending on your configuration) allow you to print/store/manipulate that data.
Last edited by krohnjw : March 7th, 2004 at 08:29 PM.
|
| |
March 7th, 2004, 08:45 PM
|
#6 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Gold Coast,Australia
Posts: 2,475
|
ok thanks, your little code bit works fine. Is it possable that the webmonkey tutotial is out of date an wont work with the newest PHP?
Could you point me to a good place to learn php?
Thanks.
Edit: btw I pasted the wrong code into my post before, in the actual code I'm really testing with the variable names are the same on both pages.
Last edited by [Neo770] : March 7th, 2004 at 08:49 PM.
|
| |
March 7th, 2004, 08:52 PM
|
#7 (permalink)
| | dword to your moms
Join Date: Oct 2001 Location: ~/
Posts: 3,195
|
The code they have on webmokeys allows you direct interface to those variables, whereas i dont think that is the defaul setup, you must use $_POST[] and $_GET[].
As far as online places, nope  There are a few good books out there though, the quickstart visual guides for PHP and PHP and mysql. |
| |
March 7th, 2004, 09:00 PM
|
#8 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Gold Coast,Australia
Posts: 2,475
|
OK thank you for all your help. Looks like il be of to find a book sometime then.  |
| |
March 10th, 2004, 01:37 PM
|
#9 (permalink)
| | Ultimate Member
Join Date: Nov 2001 Location: Winston-Salem, NC
Posts: 1,440
|
well http://php.net has a good function database with details on how to use all of the functions. not really good as a tutorial but it helps.
__________________
Visit http://duroo.org
|
| |
March 10th, 2004, 07:17 PM
|
#10 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Gold Coast,Australia
Posts: 2,475
|
Thanks, I know PHP.net has some information, but I need to start from the beggening so I know how to put it all together.  |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |