Brand new to all this, probably very basic issue
Posted by: esanders (---.dc.dc.cox.net)
Date: March 30, 2010 03:15AM

Right from the jump I'm going to apologize for being a complete newb.

I've been using Wordpress for a while and I really like it, but I'd like to be able to customize my blog a bit and maybe write some plugins for it. In that spirit I'm trying to learn PHP and I'm trying to use WampServer as a development environment.

I've installed WampServer and everything appears to be working on face. Tray icon is fully white and status message says everything is online. I'm working through a book where I've written an html page and a script that is called by the html page. pretty basic stuff.

Whenever I try to submit the form data from the page to test it, the resulting page is just a rehash of the script.

I believe I have the files in the proper www folder for it to run, but since I've never used this stuff before I'm not 100% sure about anything.

Any thoughts on what I might be doing wrong or have set up wrong would be greatly appreciated. If that's not enough info to help, let me know what's needed.

Thanks in advance.

Options: ReplyQuote
Re: Brand new to all this, probably very basic issue
Posted by: yfastud (Moderator)
Date: March 30, 2010 04:58AM

make sure your script comply w/ current php version since most people have problem because they use some sample from the book for older php version; for example:

Older php:
$var1 = $HTTP_POST_VARS['var1'];

Current php:
$var1 = $_POST['var1'];

to setup basic website, follow this
[blog.jlbn.net]

to setup wordpress, follow this
[blog.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Brand new to all this, probably very basic issue
Posted by: esanders (65.214.169.---)
Date: March 30, 2010 07:22PM

The book I'm using his Headfirst PHP and MySQL and it is teaching PHP 5. The syntax in the examples in the book are the same as the current php sample you gave above so I don't think that's the issue.

Options: ReplyQuote
Re: Brand new to all this, probably very basic issue
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: March 30, 2010 07:51PM

post ur script

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Brand new to all this, probably very basic issue
Posted by: esanders (---.dc.dc.cox.net)
Date: March 31, 2010 12:16AM

Okay, hopefully this won't be overkill, but I'm going to try to give more than might be needed. To help give full context, I'm writing these in Notepad++ and when I want to test them I'm selecting Run>Launch in Firefox. Then filling out the form and clicking the submit button. The result is simply a page in Firefox that displays the script again.

And for what its worth, my OS is Windows XP SP3

HTML page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[www.w3.org];
<html xmlns="[www.w3.org]; xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aliens Abducted Me - Report an Abduction</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h2>Aliens Abducted Me - Report an Abduction</h2>

<p>Share your story of alien abduction:</p>
<form method="post" action="report.php">
<label for="firstname">First name:</label>
<input type="text" id="firstname" name="firstname" /><br />
<label for="lastname">Last name:</label>
<input type="text" id="lastname" name="lastname" /><br />
<label for="email">What is your email address?</label>
<input type="text" id="email" name="email" /><br />
<label for="whenithappened">When did it happen?</label>
<input type="text" id="whenithappened" name="whenithappened" /><br />
<label for="howlong">How long were you gone?</label>
<input type="text" id="howlong" name="howlong" /><br />
<label for="howmany">How many did you see?</label>
<input type="text" id="howmany" name="howmany" /><br />
<label for="aliendescription">Describe them:</label>
<input type="text" id="aliendescription" name="aliendescription" size="32" /><br />
<label for="whattheydid">What did they do to you?</label>
<input type="text" id="whattheydid" name="whattheydid" size="32" /><br />
<label for="fangspotted">Have you seen my dog Fang?</label>
Yes <input id="fangspotted" name="fangspotted" type="radio" value="yes" />
No <input id="fangspotted" name="fangspotted" type="radio" value="no" /><br />
<img src="fang.jpg" width="100" height="175"
alt="My abducted dog Fang." /><br />
<label for="other">Anything else you want to add?</label>
<textarea id="other" name="other"></textarea><br />
<input type="submit" value="Report Abduction" name="submit" />
</form>
</body>
</html>

PHP script

<html>
<head>

<title>Aliens Abducted Me - Report an Abduction</title>

</head>
<body>

<h2>Aliens Abducted Me - Report an Abduction</h2>

<?php

$name = $_POST ['firstname']. ' '. $_POST['lastname'];
$when_it_happened = $_POST ['whenithappened'];
$how_long = $_POST ['howlong'];
$how_many = $_POST ['howmany'];
$alien_description = $_POST ['aliendescription'];
$what_they_did = $_POST ['whattheydid'];
$fang_spotted = $_POST ['fangspotted'];
$email = $_POST ['email'];
$other = $_POST ['other'];

echo 'Thanks for submitting the form.<br />';
echo 'You were abducted ' . $when_it_happened;
echo ' and were gone for ' . $how_long . '<br />';
echo 'There were ' . $how_many . '<br />';
echo 'Describe them: ' . $alien_description . '<br />';
echo 'The things they did to you included:' . $what_they_did . '<br />';
echo 'Was Fang there? ' . $fang_spotted . '<br />';
echo 'Other comments: ' . $other . '<br />';
echo 'Your email address is ' . $email;

?>

</body>
</html>

Options: ReplyQuote
Re: Brand new to all this, probably very basic issue
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: March 31, 2010 02:34AM

are you opening the browser and going to localhost/filename.html?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Brand new to all this, probably very basic issue
Posted by: yfastud (Moderator)
Date: March 31, 2010 03:59AM

I knew you might have that problem and that's why I've posted the guides but seem you never looked at them

to setup basic website, follow this
[blog.jlbn.net]

to setup wordpress, follow this
[blog.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.