Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Pls i will like to know the cause of my php page of showing blank page when loading. Below is the code i used to design the page using php/mysql:
<html>
<head>
<title>ADD ADDRESS</title>
</head><body>
<?php
$username = "db_ifyzza";
$password = "systembuilder";
$db_server= "istcyberworld.com";
$databse = "db_ifyzza";$dbcnx = @mysql_connect($db_server, $username, $password) or die("Cannot connect to the database.
" . mysql_error());$db_select = mysql_select_db(db_ifyzza, $dbcnx) or die ("Cannot select the database.
" . mysql_error());
if(!empty($fname))
{
$fname = addslashes($fname);
$lname = addslashes($lname);
$email = addslashes($email);
$address = addslashes($address);
$sql = "INSERT INTO tblAddress SET FirstName = '$fname', LastName = '$lname', Email = '$email', Address = '$address' ";$query = mysql_query($sql) or die ("Cannot query the database.
" . mysql_error());echo "Data Updated.";
}else{
?>Add Address
<form name = "test" method = "post" action = "<?php echo $PHP_SELF; ?>" >
First Name: <input type = "text" name = "fname">
Last Name: <input type = "text" name = "lname">
Email: <input type = "text" name = "email">
Address:
<textarea name = "address"></textarea>
<input type = "submit" name = "Submit" value = "Submit">
</form><?php
}
?>
</body></html>
Pls do tell me what to do to debug this error. Thanks.

After inserting the data there is no where to go. Redirect the page to some other page or the same page after
' echo "Data Updated."; '
using header() function.
or
remove the if-else and instead of
if(!empty($fname))
use
if(isset($HTTP_POST_VARS["Submit"])
and remove the 'else' condition.
Hope this helps,
Sean.

<form name = "test" method = "post" action = "<?php echo $PHP_SELF; ?>" >
shouldnt it be
<form name = "test" method = "post" action = "<?php echo $_POST['PHP_SELF']; ?>" >
that could be your problem.
its either that or because you're closing the PHP parsing in the "else" statement so it's messing up the script. i gotta go though, class just got out, later
FBI AgentAIM: EliteAssassin187

this is how i would do it
<?php
$form = <<< FORM
<form name = "test" method = "post" action = "{echo $_POST['PHP_SELF']}" > //something like this in this kinda of constant, but i dont remember exactly
First Name: <input type = "text" name = "fname">
Last Name: <input type = "text" name = "lname">
Email: <input type = "text" name = "email">
Address:
<textarea name = "address"></textarea>
<input type = "submit" name = "submit" value = "Submit">
</form>
FORM;
if(isset($_POST['submit'])) // i changed the name of the form from SUbmit to submit
{$username = "db_ifyzza";
$password = "systembuilder";
$db_server= "istcyberworld.com";
$databse = "db_ifyzza";
$dbcnx = @mysql_connect($db_server, $username, $password) or die("Cannot connect to the database.
" . mysql_error());
$db_select = mysql_select_db(db_ifyzza, $dbcnx) or die ("Cannot select the database.
" . mysql_error());
$fname = addslashes($fname);
$lname = addslashes($lname);
$email = addslashes($email);
$address = addslashes($address);
$sql = "INSERT INTO tblAddress SET FirstName = '$fname', LastName = '$lname', Email = '$email', Address = '$address' ";
$query = mysql_query($sql) or die ("Cannot query the database.
" . mysql_error());
mysql_close($dbcnx);
echo "Data Updated.";}else{
{ echo $form;}
?>FBI Agent
AIM: EliteAssassin187

![]() |
.hpgl / .obj file extensi...
|
Caller ID in Visual Basic
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |