#1
|
||
|
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 ) |
#2
|
||
|
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 |
#3
|
||
|
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)
|
#4
|
||
|
lol PHP is dead easy if you already know a programming language, its a lot of ifs and elses
|
#5
|
||
|
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!
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
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 |