home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1962
Discussions: 188,397, Posts: 2,243,588, Members: 232,626
Old March 5th, 2004, 01:48 AM   Digg it!   #1 (permalink)
Ultimate Member
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 2,475
Send a message via MSN to [Neo770]
Arrow
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 March 7th, 2004, 07:37 PM     #2 (permalink)
Ultimate Member
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 2,475
Send a message via MSN to [Neo770]
Bump, I still have know idea.
__________________
(\(\
(o'.')
(,,)('')('')

[Neo770] is offline   Reply With Quote
Old March 7th, 2004, 08:02 PM     #3 (permalink)
dword to your moms
 
krohnjw's Avatar
 
Join Date: Oct 2001
Location: ~/
Posts: 3,195
Send a message via AIM to krohnjw
Does anything show?
Post your actual code.

krohnjw is offline   Reply With Quote
Old March 7th, 2004, 08:10 PM     #4 (permalink)
Ultimate Member
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 2,475
Send a message via MSN to [Neo770]
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 March 7th, 2004, 08:27 PM     #5 (permalink)
dword to your moms
 
krohnjw's Avatar
 
Join Date: Oct 2001
Location: ~/
Posts: 3,195
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 : March 7th, 2004 at 08:29 PM.
krohnjw is offline   Reply With Quote
Old March 7th, 2004, 08:45 PM     #6 (permalink)
Ultimate Member
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 2,475
Send a message via MSN to [Neo770]
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.
[Neo770] is offline   Reply With Quote
Old March 7th, 2004, 08:52 PM     #7 (permalink)
dword to your moms
 
krohnjw's Avatar
 
Join Date: Oct 2001
Location: ~/
Posts: 3,195
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 March 7th, 2004, 09:00 PM     #8 (permalink)
Ultimate Member
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 2,475
Send a message via MSN to [Neo770]
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 March 10th, 2004, 01:37 PM     #9 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,440
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.
__________________
Visit http://duroo.org
cracked is offline   Reply With Quote
Old March 10th, 2004, 07:17 PM     #10 (permalink)
Ultimate Member
 
[Neo770]'s Avatar
 
Join Date: Oct 2001
Location: Gold Coast,Australia
Posts: 2,475
Send a message via MSN to [Neo770]
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

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

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

Most Active Discussions
Is It Just Me? (2904)
Unarmed man on his stomach shot by .. (6)
3-days in and no threads about Gaza (160)
New Build ( Finally ) (6)
Building a gaming computer advice (5)
CPU wont boot (7)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (444)
Upgrading RAM (6)
Recent Discussions
wishin i could edit my aol prof.. (0)
For cheap price and good qualit.. (0)
RCA 52Inch HDTV wont turn on (3)
Sporadic internet connectivity (2)
Assassins Creed PC Problems (40)
I think my PSU is dieing (1)
Left 4 Dead Small Freezes (2)
building a gaming computer, inp.. (0)
Iming and surfing slowed down (3)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 02:50 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28