Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-20-2004, 09:42 PM
PHP-Largo
Unregistered

Posts: n/a

Would this work?

<html><head><title>Welcome to my Guest Book! - Powered by !EliteGuestBookV.1.0.0</title></head>
<body>
<p>Add to my guest book:<p>
<?php

If ($first=="" || $email=="" || $comments=="") {
//makes it so if they left it empty they will
//have to redo it, lol learned
//that from panther
echo ("Not all required forms are filled, you must fill in: Name, Email, and Comments.");


if ($submit) {

// process form

$db = mysql_connect("localhost", "root");

mysql_select_db("mydb",$db);

$sql = "INSERT INTO guestbook (first,email,comments) VALUES ('$first','$email','$comments')";

$result = mysql_query($sql);

echo "Thank you! Information entered.\n";

} else{



// display form



?>

<form method="Post" action="guestbook.php">
Name:<input type="text" name="first" size="20"></p>
<p>Email: <input type="text" name="email" size="20"></p>
<p>Comments:</p>
<p><textarea rows="5" name="comments" cols="21"></textarea></p>
<p>
<input type="submit" value="Add entry!" name="B1" style="border-style: solid; border-width: 1"><input type="reset" value="Reset Forms" name="B2" style="border-style: solid; border-width: 1"></p>
</form>
<?php
/* Made by -Elite-, visit www.squad-host.com for more info! Now first we make it so it shows the entries*/
$db = mysql_connect("localhost", "root");

mysql_select_db("mydb",$db);

// display individual record

$result = mysql_query("SELECT * FROM guestbook",$db);

while ($myrow = mysql_fetch_array($result)) {

printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF, $myrow["first"], $myrow["email"], $myrow["comments"]);

}

}


}Else{
// In case the data doesn't load or there
// are no entries we'll have text to display
print ("Either the data will not load, or there have been no entries! Please fill out a entry at the top!);
?>
</body>
</html>

Would this work as a guest book? If not please help guide me through this. I used the hotwired lycos. I read through the Tutorial, and then created this script (Very similar to there's except I kkinda built it in my way )
Reply With Quote
  #2  
Old 07-20-2004, 10:24 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

I don't see why not, cept I don't see why you have the last } Else { in there.. Give it a try .
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #3  
Old 07-20-2004, 11:31 PM
PHP-Largo
Unregistered

Posts: n/a

I will have to. I'm planning on making a mailer next. Lol following in your foot steps jk anyways it will have the ability to cast a vote and so on, then be sent to the admin. I will probaly be here in a soon while to post a question. Sorry to take your time, but i'm getting php and soon I'll be creating scripts like you (In 990 years lol)
Reply With Quote
  #4  
Old 07-23-2004, 02:32 PM
Systemkaos
Unregistered

Posts: n/a

lol PHP is dead easy if you already know a programming language, its a lot of ifs and elses
Reply With Quote
  #5  
Old 07-24-2004, 12:18 PM
PHP-Largo
Unregistered

Posts: n/a

ya wish i knew a programming language. I'm going to keep on posting questions, here , and at other places as well as read books, do easy and harder scripts, see others, and examples!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
i cant get it to work :( .Simon. Web design and Programming 18 06-04-2005 05:05 AM
New Work BaLoR Sigs and Graphics 10 08-28-2004 08:03 PM
My best work so far D STROYER Sigs and Graphics 10 08-12-2004 04:59 PM
New Work Fire Sigs and Graphics 14 07-23-2003 12:35 PM
does it work Stain ev Sigs and Graphics 0 06-05-2003 11:42 PM


All times are GMT -5. The time now is 02:07 AM.




Powered by vBulletin®