Are you able to run PHP locally (WAMPP)? These might help:
Test scripts: http://www.karakas-online.de/EN-Book/test-scripts.html
Simple Test for PHP: http://www.lastcraft.com/simple_test.php
Ron
-------Original Message-------
From: StarTrekCafe
Date: 6/25/2012 12:18:07 AM
To: web-design@yahoogroups.com
Subject: [web-design] updated php help
hi.
well uplodaded it to http://blindaid.ultraweb.us/index.php. but when i try
to do the register.php file. got an error. and not sure why. not liking the
query. will also paste the file of the assignment as well. my form code and
also my register.php code. can any one help , and and help me out to test,
and any other tips, for php and code. thanks.
Marvin.
register code.
http://blindaid.ultraweb.us/register.php
Parse error: syntax error, unexpected T_STRING in
/home/blindaid/public_html/register.php on line 114
ps: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registration</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Registration Form:</h1>
<p>Welcome To the Registration Form. Please fill out all fields marked with
a *.</p>
<br />
<form action="register.php" method="post">
<p><input name="* Firstname:" type="text" size="50" value="firstname" /></p>
<p><input name="* Lastname:" type="text" size="50" value="lastname" /></p>
<p><input name="* Address:" type="text" size="50" value="address" /></p>
<p><input name="* Suburb:" type="text" size="50" value="suburb" /></p>
<p><input name="* Post Code:" type="text" size="4" value="postcode" /></p>
<p><input name="* Phone:" type="text" size="30" value="phone" /></p>
<p><input name="* Mobile Phone:" type="text" size="30" value="mobile" /></p>
<p><input name="* E-mail:" type="text" size="50" value="email" /></p>
<p><input name="* User Name:" type="text" size="50" value="userName" /></p>
<p><input name="* Password:" size="50" type="password" /></p>
<p><input name="Submit" type="submit" value="submit" /></p>
<p><input name="Reset" type="reset" value="reset" /></p>
</form>
<?php include('header.php'); ?>
</body>
</html>
ps: and here's the register code.
not liking it on line 114.
am i just being stupid.
did have a look at some other php code and other resources.
but looks the same.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registration</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include('header.php'); ?>
<?php
$firstname="";
$lastname="";
$address="";
$suburb="";
$postcode="";
$phone="";
$mobile="";
$email="";
$username="";
$password="";
if (isset($_POST['submit']))
{
$firstname=$_POST['firstname'];
if ($_POST['submit'])
{
$firstname=$_POST['firstname'];
if ($_POST['firstname'] != "")
{
echo "<p>You did not enter a valid Firstname! Please enter a valid Firstname
entry for this field!</p>";
}
else
{
echo "<p>Success! This Firstname field has been filled in! Please fill in
the Lastname field on this form!</p>";
}
$lastname=$_POST['lastname'];
if ($_POST['lastname'] != "")
{
echo "<p>You did not enter a valid Lastname! Please enter a valid Lastname
entry for this field!</p>";
}
else
{
echo "<p>Success! This Lastname field has been filled in! Please fill in the
Address field on this form!</p>";
}
$address=$_POST['address'];
if ($_POST['address'] != "")
{
echo "<p>You did not enter a valid Address! Please enter a valid Address
entry for this field!</p>";
}
else
{
echo "<p>Success! This Suburb field has been filled in! Please fill in the
PostCode field on this form!</p>";
}
$postcode=$_POST['postcode'];
if ($_POST['postcode'] != "")
{
echo "<p>You did not enter a valid PostCode! Please enter a valid PostCode
entry for this field!</p>";
}
else
{
echo "<p>Success! This PostCode field has been filled in! Please fill in the
Phone field on this form!</p>";
}
$phone=$_POST['phone'];
if ($_POST['phone'] != "")
{
echo "<p>You did not enter a valid Phone Number! Please enter a valid Phone
Number entry for this field!</p>";
}
else
{
echo "<p>Success! This Phone field has been filled in! Please fill in the
Mobile Phone field on this form!</p>";
}
$mobile=$_POST['mobile'];
if ($_POST['mobile'] != "")
{
echo "<p>You did not enter a valid Mobile Phone Number! Please enter a valid
Mobile Phone Number entry for this field!</p>";
}
else
{
echo "<p>Success! This Mobile Phone field has been filled in! Please fill in
the E-mail field on this form!</p>";
}
$email=$_POST['email'];
if ($_POST['email'] != "")
{
echo "<p>You did not enter a valid E-mail Address! Please enter a valid
E-mail Address entry for this field!</p>";
}
else
{
echo "<p>Success! This E-mail field has been filled in! Please fill in the
User Name field on this form!</p>";
}
$username=$_POST['username'];
if ($_POST['username'] != "")
{
echo "<p>You did not enter a valid User Name! Please enter a valid User Name
entry for this field!</p>";
}
else
{
echo "<p>Success! This User Name field has been filled in! Please fill in
the Password field on this form!</p>";
}
$password=$_POST['password'];
if ($_POST['password'] != "")
{
echo "<p>You did not enter a valid Password! Please enter a valid Password
entry for this field!</p>";
}
else
{
echo "<p>Success! This Password field has been filled in! You have
successfully filled in all fields completely on this form! Please Click the
Submit button to submit the details of this form!</p>";
}
$user="root";
$password="password";
$server="localhost";
$database="registration";
$connection=mysql_connect('localhost','root','password');
$db=mysql_select_db($database, $connection) or die ("Unable to connect to
database");
$sql = "INSERT INTO users (firstname, lastname, address, suburb, postcode,
phone, mobile, email, userName, password) VALUES ('$firstname', '$lastname',
'$address', '$suburb', '$postcode', '$phone', '$mobile', '$email',
$userName', '$password');
$query = "SELECT * FROM users";
$result = mysql_query($query, $connection) or die ("Error in query: "
mysql_error());
while($row = mysql_fetch_array($result))
{
echo "<table>";
echo "<tr>
echo "<td><h1>Registration Details</h1></td>";
echo "<td><br /></td>";
echo "<<td><h1>Firstname</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['firstname']."</td>";
echo "<br />";
echo "</tr>";
echo "<tr>";
echo " <td><h1>Lastname</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['lastname']."</td>";
echo "<td><br /></td>";
echo "</tr>";
echo "<tr>";
echo "<td><h1>Address</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['address']."</td>";
echo "<td><br /></td>";
echo "</tr>";
echo "<tr>";
echo "<td><h1>Suburb</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['suburb']."</td>";
echo "<td><br /></td>";
echo "</tr>";
echo "<tr>";
echo "<td><h1>PostCode</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['postcode']."</td>";
echo "<td><br /></td>";
echo "<h1>Phone</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['phone']."</td>";
echo "<td><br /></td>";
echo "</tr>";
echo "<tr>";
echo "<td><h1>Mobiel Phone</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['mobile']."</td>";
echo "<td><br /></td>";
echo "</tr>";
echo "<tr>";
echo "<td><h1>E-mail</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['email']."</td>";
echo "<td><br /></td>";
echo "</tr>";
echo "<td><h1>User Name</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['userName']."</td>";
echo "<td><br /></td>";
echo "</tr>";
echo "<tr>";
echo "<td><h1>Password</h1></td>";
echo "<td><br /></td>";
echo "<td>.$row['password']."</td>";
echo "</tr>";
echo "</table>
}
}
}
mysql_close();
?>
</body>
</html>
and if any one can help me to test for errors. that would be great. so making progress.
[Non-text portions of this message have been removed]
web-design@yahoogroups.com is sponsored, owned, and founded by Technogypsie Designs (formerly Wandering Leaf Designs)
~etching your presence on the web
leafworks@yahoo.com
To unsubscribe or change your settings:
Please go to http://www.yahoogroups.com
- login, - choose group to modify, - change to unsubscribe,
web only, digest, or single post mode
By email: send a email from your email address receiving this
post to web-design-unsubscribe@yahoogroups.com
0 comments:
Post a Comment