Current location: Hot Scripts Forums » Programming Languages » PHP » Newbie: Blank screen again


Newbie: Blank screen again

Reply
  #1 (permalink)  
Old 01-21-05, 07:19 PM
Asmerus Asmerus is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Newbie: Blank screen again

I'm new to it all, just reading ebooks and forums to learn php and mysql..and even linux at that...I battle through sockets, SElinux secuirty and finally got my test.php to print out all the information...so i followed a guide to make a simple questbook as my first learn as you do....now every time i hit the submit button I get the blank screen. nothing on it.
so besides the obvious "how do i stop this" I was also wondering how do get error logs or get my php to make error logs so maybe i can figure this out on my own.. well here is the scripts.
[ it is sign.php, but i had it as sign.html and made no diffrence ]
<html>

<body>

<h3>Testing out Input and Forms</h3><br>

<FORM ACTION="addentry.php" METHOD=POST>

First Name: <br>

<input type="text" name="firstname" maxlength="30"><br>

Last Name: <br>

<input type="text" name="lastname" maxlength="30"><br>
Email: <br>
<input type="text" name="email" maxlength="80"><br>
Location: <br>
<input type="text" name="location" maxlength="50"><br>
URL: <br>
<input type="text" name="url" maxlength="80"><br>
Comments: <br>
<textarea name="comments" cols="40" rows="4" wrap="virtual"> </textarea><br>

<input type="submit" value="Send it!">

<input type="reset" value="Scratch That">

</form>

</body>

</html>


[and now addentry.php]

<?php
mysql_connect("localhost","asm","-removed-") or
die ("Could not connect to database")
mysql_select_db("guestbook") or
die ("Could not select database")

if ($submit == "Send it!")
{
$query = "insert into guestbook
(firstname,lastname,email,location,url,comments) values
('$firstname', '$lastname', '$email', '$location', '$url', '$comments)";
mysql_query($query) or
die (mysql_error());
?>
<h2>Thanx!!</h2>
<h2><a href="view.php">View My Guest Book!!!<a/></h2>
<?php
}
else
{
include("sign.php");
}
?>

I am using Fedora Core 3, my apache server and mysql server run fine, all the files are kept in the default /var/www/html/ and basically every developer tool is on and updated so i do have php-mysql...if you need anymore info just ask
Reply With Quote
  #2 (permalink)  
Old 01-21-05, 07:29 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
try changing this:
PHP Code:

if ($submit == "Send it!"
to this:
PHP Code:

if (isset($_POST['submit'])) 

and change this:
Code:
<input type="submit" value="Send it!">
to this:
Code:
<input type="submit" name="submit" value="Send it!">
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 01-21-05, 07:44 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
$query = "insert into guestbook
(firstname,lastname,email,location,url,comments) values
('$firstname', '$lastname', '$email', '$location', '$url', '$comments)";

You forgot an apostrophe after $comments....

$query = "insert into guestbook
(firstname,lastname,email,location,url,comments) values
('$firstname', '$lastname', '$email', '$location', '$url', '$comments')";
Reply With Quote
  #4 (permalink)  
Old 01-21-05, 07:48 PM
Asmerus Asmerus is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
no dice

didn't help...still blank screen for the first one...i will check this second reply..lets hope
Reply With Quote
  #5 (permalink)  
Old 01-21-05, 07:55 PM
Asmerus Asmerus is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mdhall
$query = "insert into guestbook
(firstname,lastname,email,location,url,comments) values
('$firstname', '$lastname', '$email', '$location', '$url', '$comments)";

You forgot an apostrophe after $comments....

$query = "insert into guestbook
(firstname,lastname,email,location,url,comments) values
('$firstname', '$lastname', '$email', '$location', '$url', '$comments')";
...still nothing, pure blank screen, mysql database isn't even being touched so i am guessing the query is just dieing before hand...but why i don't know
Reply With Quote
  #6 (permalink)  
Old 01-21-05, 09:27 PM
Sabu Sabu is offline
Junior Code Guru
 
Join Date: Sep 2004
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, here we go. To start with,
Code:
mysql_connect("localhost","asm","-removed-") or
die ("Could not connect to database")
mysql_select_db("guestbook") or
die ("Could not select database")
These two commands don't end in semicolons. They should. And.. actually, that's it. Along with the advice already offered above.
Reply With Quote
  #7 (permalink)  
Old 01-21-05, 10:18 PM
Asmerus Asmerus is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Lol

of all the stupid mistakes I could of made. To think 2 missing semi colons does it...lol thanx man, and thanx to rest for helping me fix up some other things :

had to edit this one....I was so happy that it worked...i used mysql to look at the data base and it would seem it added all nulls, so there is an entry but all of it is empty space

Last edited by Asmerus; 01-21-05 at 10:23 PM.
Reply With Quote
  #8 (permalink)  
Old 01-21-05, 10:48 PM
Sabu Sabu is offline
Junior Code Guru
 
Join Date: Sep 2004
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
In that case, maybe your script ins't regiserting globals. Change your $family into $_POST[family] and likewise for the other form variables when you're putting them into the database.
Reply With Quote
  #9 (permalink)  
Old 01-22-05, 09:01 AM
Asmerus Asmerus is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Question not getting you

I thought it was something like that, so I "cured it with

$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];
$location=$_POST['location'];
$url=$_POST['url'];
$comments=$_POST['comments'];

before my if statement...I am sure there is an easier way but I don't know it.
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
Blank screen when form is submitted kibby67 PHP 6 12-03-04 10:09 AM
Newbie webbie tolongges New Members & Introductions 3 09-13-04 05:11 AM
resizing screen.... jasong The Lounge 4 03-29-04 06:13 AM
screen area(resolution) msrnivas ASP.NET 1 12-18-03 12:54 PM
blank screen? darkcarnival PHP 10 11-17-03 06:16 AM


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