PHP scripting error? or settings error?
Posted by: xpgamer (---.lightspeed.gdrpmi.sbcglobal.net)
Date: August 29, 2010 12:14AM

So, I don't know who to talk to about having problems about php when I myself am the only person I know is teaching himself php. T.T

Anyway I have been having some problems with trying to do forms. I don't think it is sending the data and responding appropriately. Now I have no idea of what the problem may be because one, I just started learning php about a month ago, so I'm at a loss for words.I'm going to just show you my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"[www.w3.org];

<html xmlns="[www.w3.org]; xml:lang="en">

<head>
<title>PHP Script</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
<h2>Please enter your personal details:</h2>

<form action="example10-3.php" method="post">
<p>
<label for="strFirstname">Firstname: </label>
<input type="text" name="strFirstname" id="strFirstname"/>
</p><p>
<label for="strSurname">Surname: </label>
<input type="text" name="strSurname" id="strSurname"/>
</p><p>
<label for="strUsername">Username: </label>
<input type="text" name="strUsername" id="strUsername"/>
</p><p>
<label for="strPassword">Password: </label>
<input type="password" name="strPassword" id="strPassword"/>
</p><p>
<input type="submit" name="submit"/>
</p>
</form>


<?php
// File: example3-3.php

if (isset($_POST["submit"])) {
$strFirstname = $_POST["strFirstname"];
$strSurname = $_POST["strSurname"];
$strUsername = $_POST["strUsername"];
$strPassword = $_POST["strPassword"];

echo "<p>Greetings $strFirstname $strSurname</p>";
echo "<p>Your username is $strUsername and your password is $strPassword</p>";
} ?>
</body>
</html>

///////////////////////

Now when I try to find the end results of this page I see the text boxes submit button, etc. What's weird to me though is I see this at the bottom of the page:

Greetings $strFirstname $strSurname"; echo "

Your username is $strUsername and your password is $strPassword
"; } ?>

I feel baffle because I know I shouldn't see the ";}?> there and among other things. please help T_T

Options: ReplyQuote
Re: PHP scripting error? or settings error?
Posted by: yfastud (Moderator)
Date: August 29, 2010 12:41AM

You have a little error in your script

Find:
<form action="example10-3.php" method="post">
Change to:
<form action="example3-3.php" method="post">
Save file as "example3-3.php" and try again. BTW, next time you should join some coding forums for help on scripts winking smiley

Have fun,

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



Edited 1 time(s). Last edit at 08/29/2010 12:42AM by yfastud.

Options: ReplyQuote


Sorry, only registered users may post in this forum.