Current location: Hot Scripts Forums » Programming Languages » PHP » Problem with php


Problem with php

Reply
  #1 (permalink)  
Old 05-29-10, 09:18 PM
gogo_k gogo_k is offline
New Member
 
Join Date: May 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Problem with php

i have a probblem with this code:
does not show anything , only white in my broswer
and not getting an error message
___________________________________

<?php
session_start();

$con=mysql_connect("localhost", "root", "123456");
if(!$con)
{
die("Could not connect to database" . mysql_error());
}
else echo "Connection achieved". "<br/>";
?>

<html>
<head>
<title>Register</title>
</head>
<body background="sunglasses.jpg">

<?php
if (isset($_POST['submit']) && $_POST['submit'] == "Register")
{
if ($_POST['customer_username'] != "" && $_POST['customer_firstname'] != "" && $_POST['customer_lastname'] != "" && $_POST['customer_username'] != "" && $_POST['customer_password'] != "" && $_POST['customer_email'] != "")
{
$query=("SELECT customer_username FROM customer WHERE customer_username = '" . $_POST['customer_username'] . "'");
$result= mysql_query($query,$con) or die (mysql_error());
if (mysql_num_rows($result) != 0)
{
?>
<p>
<font face="comic sans ms"><b>The Username <?php echo $_POST['customer_username']; ?>, "</b></font>
<form color="#FF0000" action="register.php" method="post">
First Name: <input type="text" name="cutomer_firstname" value=" <?php echo $_POST['customer_firstname']; ?>" ><br>
Last Name: <input type="text" name="cutomer_lastname" value= "<?php echo $_POST['customer_lastname']; ?>" ><br>
User name: <input type="text" name="customer_username"><br>
Password: <input type="password" name="cutomer_password"><br>
E-mail: <input type="text" name="cutomer_email" value= "<?php echo $_POST['customer_email']; ?> "><br>
Address 1: <input type="text" name="cutomer_add1" value= "<?php echo $_POST['customer_add1']; ?> "><br>
Address 2: <input type="text" name="cutomer_add2" value= "<?php echo $_POST['customer_add2']; ?>"> <br>
City: <input type="text" name="cutomer_city" value= "<?php echo $_POST['customer_city']; ?> "><br>
Zip: <input type="text" name="cutomer_zip" value= "<?php echo $_POST['customer_zip']; ?>" ><br>
Phone: <input type="text" name="cutomer_phone" value= "<?php echo $_POST['customer_phone']; ?>" ><br><br>
<input type="submit" name="submit" value="Register"> &nbsp;
<input type="reset" value="Clear">
</form></p>

<?php
}
else
{
$query = "INSERT INTO `customer` (`customer_firstname`, `customer_lastname`, `customer_username`, `customer_password`, `customer_email`, `customer_add1`, `customer_add2`, `customer_city`, `customer_zip`, `customer_phone`)
VALUES ('" . $_POST['customer_firstname'] . "','" . $_POST['customer_lastname'] . "','" . $_POST['customer_username'] . "','" . $_POST['customer_password'] . "','" . $_POST['customer_email'] . "','" . $_POST['customer_add1'] . "','" . $_POST['customer_add2'] . "','" . $_POST['customer_city'] . "','" . $_POST['customer_zip'] . "','" . $_POST['customer_phone'] . "')";
$result = mysql_query($query,$con) or die (mysql_error());
$_SESSION['user_logged'] = $_POST['customer_username'];
$_SESSION['user_password'] = $_POST['customer_password'];
?>
<p>
"Thank you <?php echo $_POST["customer_firstname"] ." " . $_POST["customer_lastname"];?>"</b> for registering!<br>";
<?php
//header("Refresh: 5; URL=intex.php");
echo "Your registration is complete!<br>";
echo " If your browser doesn’t support this, <a href="index.php">click here</a>)";
die();
}
}
else
{
?>
<font face="comic sans ms"><b>All fields are required!"</b></font>
<form color="#FF0000" action="register.php" method="post">
First Name: <input type="text" name="cutomer_firstname" value= "<?php echo $_POST['customer_firstname']; ?> "><br>
Last Name: <input type="text" name="cutomer_lastname" value= "<?php echo $_POST['customer_lastname']; ?> "><br>
User name: <input type="text" name="customer_username" value= "<?php echo $_POST['customer_username']; ?> "><br>
Password: <input type="password" name="cutomer_password" value="</php echo $_POST['customer_password'];>"><br>
E-mail: <input type="text" name="cutomer_email" value= "<?php echo $_POST['customer_email']; ?> "><br>
Address 1: <input type="text" name="cutomer_add1" value= "<?php echo $_POST['customer_add1']; ?>"><br>
Address 2: <input type="text" name="cutomer_add2" value= "<?php echo $_POST['customer_add2']; ?>" ><br>
City: <input type="text" name="cutomer_city" value= "<?php echo $_POST['customer_city']; ?> ><br>
Zip: <input type="text" name="cutomer_zip" value= "<?php echo $_POST['customer_zip']; ?>" ><br>
Phone: <input type="text" name="cutomer_phone" value= "<?php echo $_POST['customer_phone']; ?> "><br><br>
<input type="submit" name="submit" value="Register"> &nbsp;
<input type="reset" value="Clear">
</form></p>

<?php
}
}
else
{
?>

<p>
Registration page!<br>
<b>All the fields required!</b>
<form color="#FF0000" action="register.php" method="post">
<b><font face="comic sans ms" color="#F7BDDE" > REGISTER </font></b>
<br>
Firstname <input type="text" size="20" name="customer_firstname">
<br>
Lastname <input type="text" size="20" name="customer_lastname">
<br>
User name <input type="text" size="20" name="customer_username">
<br>
Password <input type="text" size="20" name="customer_password">
<br>
E-mail <input type="text" size="20" name="customer_email">
<br>
Address 1 <input type="text" name="customer_add1">
<br>
Address 2 <input type="text" name="customer_add2">
<br>
City <input type="text" name="customer_city">
<br>
Zip <input type="text" name="customer_zip">
<br>
Phone <input type="text" name="customer_phone">
<br>
<input type="submit" name="submit" value="Register"> &nbsp;
<input type="reset" value="Clear">
</form>
</p>
<?php
}
mysql_close($con);
?>
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old 05-30-10, 03:32 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
First of all, please use the [ php] [/ php] tags around your code, that makes it more readable.

Secondly: check the error_reporting level and the display_error setting in your php.ini file. error_reporting should be set to E_ALL (and preferrable E_ALL | E_STRICT) and display_errors should be set to "On"

If you don't have access to the php.ini file, place these lines on top of your code:
PHP Code:

error_reporting (E_ALL E_STRICT);
ini_set('display_errors'true); 
For more information on both topics visit:
PHP Manual: error_reporting
PHP Manual: display_errors
error_reporting function
ini_set function
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
Reply

Bookmarks


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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem: PHP Parse error: syntax error, unexpected T_STRING joerg_jb PHP 3 07-29-09 01:46 PM
PHP login problem kaceykeleher PHP 5 03-13-09 11:23 AM
can someone help with htaccess and php problem tigherrdk PHP 6 03-09-09 02:28 AM
PHP Communication Problem Califer PHP 0 07-05-06 12:07 AM
PHP script problem (please help) osmanmumtaz PHP 0 05-24-05 07:29 AM


All times are GMT -5. The time now is 08:15 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.