Computing.Net > Forums > Programming > My php page is showing blanck!!!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

My php page is showing blanck!!!

Reply to Message Icon

Name: db_ifyzza
Date: October 25, 2004 at 17:38:49 Pacific
OS: Windows XP
CPU/Ram: 32 RAM and P II
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: seank
Date: October 27, 2004 at 23:18:12 Pacific
Reply:

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.


0

Response Number 2
Name: FBI Agent
Date: October 28, 2004 at 08:17:51 Pacific
Reply:

<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 Agent

AIM: EliteAssassin187


0

Response Number 3
Name: FBI Agent
Date: October 29, 2004 at 07:46:00 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


.hpgl / .obj file extensi... Caller ID in Visual Basic



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: My php page is showing blanck!!!

posting text on page www.computing.net/answers/programming/posting-text-on-page/7443.html

PHP formatting problem. www.computing.net/answers/programming/php-formatting-problem/18988.html

Displaying results_per_page in PERL www.computing.net/answers/programming/displaying-resultsperpage-in-perl/12726.html