Newbie: Blank screen again

01-21-05, 07:19 PM
|
|
Newbie Coder
|
|
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

01-21-05, 07:29 PM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
try changing this:
to this:
and change this:
to this:
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

01-21-05, 07:44 PM
|
 |
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')";
|

01-21-05, 07:48 PM
|
|
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
|

01-21-05, 07:55 PM
|
|
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
|

01-21-05, 09:27 PM
|
|
Junior Code Guru
|
|
Join Date: Sep 2004
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, here we go. To start with, These two commands don't end in semicolons. They should. And.. actually, that's it. Along with the advice already offered above.
|

01-21-05, 10:18 PM
|
|
Newbie Coder
|
|
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

01-21-05, 10:48 PM
|
|
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.
|

01-22-05, 09:01 AM
|
|
Newbie Coder
|
|
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|