»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 03-04-2004, 10:48 PM   #1 (permalink)
Registered User
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 1,188
[Neo770] is on a distinguished road
Finance 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.

[Neo770] is offline   Reply With Quote
Old 03-07-2004, 04:37 PM   #2 (permalink)
Registered User
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 1,188
[Neo770] is on a distinguished road
Bump, I still have know idea.
[Neo770] is offline   Reply With Quote
Old 03-07-2004, 05:02 PM   #3 (permalink)
Registered User
 
krohnjw's Avatar
 
Join Date: Oct 2001
Location: ~/
Posts: 2,567
krohnjw is on a distinguished road
Send a message via AIM to krohnjw
Does anything show?
Post your actual code.
krohnjw is offline   Reply With Quote
Old 03-07-2004, 05:10 PM   #4 (permalink)
Registered User
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 1,188
[Neo770] is on a distinguished road
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!
[Neo770] is offline   Reply With Quote
Old 03-07-2004, 05:27 PM   #5 (permalink)
Registered User
 
krohnjw's Avatar
 
Join Date: Oct 2001
Location: ~/
Posts: 2,567
krohnjw is on a distinguished road
Send a message via AIM to krohnjw
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; 03-07-2004 at 05:29 PM.
krohnjw is offline   Reply With Quote
Old 03-07-2004, 05:45 PM   #6 (permalink)
Registered User
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 1,188
[Neo770] is on a distinguished road
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]; 03-07-2004 at 05:49 PM.
[Neo770] is offline   Reply With Quote
Old 03-07-2004, 05:52 PM   #7 (permalink)
Registered User
 
krohnjw's Avatar
 
Join Date: Oct 2001
Location: ~/
Posts: 2,567
krohnjw is on a distinguished road
Send a message via AIM to krohnjw
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.
krohnjw is offline   Reply With Quote
Old 03-07-2004, 06:00 PM   #8 (permalink)
Registered User
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 1,188
[Neo770] is on a distinguished road
OK thank you for all your help. Looks like il be of to find a book sometime then.
[Neo770] is offline   Reply With Quote
Old 03-10-2004, 10:37 AM   #9 (permalink)
Registered User
 
cracked's Avatar
 
Join Date: Nov 2001
Location: NCSU @ Raleigh, NC
Posts: 1,390
cracked is on a distinguished road
Send a message via AIM to cracked
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.
__________________
Duroo
cracked is offline   Reply With Quote
Old 03-10-2004, 04:17 PM   #10 (permalink)
Registered User
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 1,188
[Neo770] is on a distinguished road
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.
[Neo770] is offline   Reply With Quote
Reply




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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 03:09 PM.