Jump to content

music_fan01

Members
  • Posts

    85
  • Joined

  • Last visited

    Never

Everything posted by music_fan01

  1. http://www.homeandlearn.co.uk/php/php12p2.html this was the example I was looking at when working on my code.
  2. My php doesnt work now with my database. At first I thought it might have been my database, but I think its my php or both.
  3. I just changed it now. I now have CREATE TABLE `guestbook`.`guest` ( `Guest Number` INT( 4 ) NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY , `Name` VARCHAR( 70 ) NULL DEFAULT NULL , `Message` VARCHAR( 200 ) NULL DEFAULT NULL , `Posted` TIMESTAMP NULL DEFAULT NULL ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <!-- header --> <div id="header"> <div id="logo"><a href="#">Header</a></div> <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Guestbook</a></li> </ul> <img src="images/twitter.png" height="49px;"/> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="text"> <h1><strong>Guestbook</strong></h1> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <form method="post" action="addguest.php"> <div align="center"></div> <div align="center"></div> <div align="center" class="style1"></div> <div align="center"><span class="style1">Name:</span><br /> <input name="name" type="text" size="30" maxlength="40" /> <br /> <br/> <br/> <span class="style1">Message:</span><br /> <textarea name="msg" cols="30" rows="6"></textarea> <br /> <br /> <input type="reset" value="Reset" /> <input type="submit" value="Send" /> </div> <div align="center"> <p> </p> </div> <?php echo "<h3>Sorry there was an error please contact me.<h3>"; ?> <!-- footer --> <div id="footer"> <div id="left_footer">© Copyright 2011<strong> Author </strong></div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> </div> </div> <!-- end footer --> </div> <!-- end main --> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <!-- header --> <div id="header"> <div id="logo"><a href="#">Header</a></div> <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">contact</a></li> <li><a href="#">Guestbook</a></li> </ul> <img src="images/twitter.png" height="49px;"/> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="text"> <h1><strong>Guestbook</strong></h1> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <?php CREATE TABLE `guestbook`.`guest` ( `Guest Number` INT( 4 ) NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY , `Name` VARCHAR( 70 ) NULL DEFAULT NULL , `Message` VARCHAR( 200 ) NULL DEFAULT NULL , `Posted` TIMESTAMP NULL DEFAULT NULL ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin; date_default_timezone_set('America/New_York'); date('h:i:s a'); $sql="INSERT INTO $guestbook (name,message, posted)VALUES('$name', '$msg', '$posted',)"; $result=mysql_query($sql); $name = $_POST['name']; $posted =$_POST['posted']; $msg = $_POST['msg']; $msg = stripslashes($msg); $posted = stripslashes($posted); $name = stripslashes($name); $msg = nl2br(htmlentities($msg)); $posted = nl2br(htmlentities($posted)); $name = nl2br(htmlentities($name)); if (empty($name) || empty($msg)) { echo "<h3>Sorry all fields are required</h3>"; } else { $timestamp=date("M-d-Y h:m:s A"); fwrite($fp, ' <font size="3"> <BR><BR> Posted: '.$timestamp.'<br /> Name: '.$name.'<BR> <BR>Message: '.$msg.'<BR> '); fclose($fp); echo '<font size="3"><p align="center">Thank you '.$name.' for singing my guestbook</p></font>'; } ?> <div align="center"></div> <div align="center"></div> <div align="center"></div> <div align="center"></div> <p align="center"><a href="guestbook.php">Back to GuestBook</a></p> <div align="center"></div> </div> <!-- footer --> <div id="footer"> <div id="left_footer">© Copyright 2011<strong> Author </strong></div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> </div> </div> <!-- end footer --> </div> <!-- end main --> </body> </html> When I run it, I get the following error: Parse error: syntax error, unexpected T_STRING in /home/a9577046/public_html/addguest.php on line 59
  4. I am not sure if I called everything right and while I was making my database, I had got no errors, but I dont know if it will work with my php.
  5. Will do. I havent had one bad experience here in this forum, count on me coming back here for my php/html/SQL/web development questions!
  6. I've made a database for my guestbook, but its been awhile since I've made one. Just wondering if someone could look over my code and possible help me with fixing my database. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <!-- header --> <div id="header"> <div id="logo"><a href="#">Header</a></div> <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Guestbook</a></li> </ul> <img src="images/twitter.png" height="49px;"/> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="text"> <h1><strong>Guestbook</strong></h1> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <form method="post" action="addguest.php"> <div align="center"></div> <div align="center"></div> <div align="center" class="style1"></div> <div align="center"><span class="style1">Name:</span><br /> <input name="name" type="text" size="30" maxlength="40" /> <br /> <br/> <br/> <span class="style1">Message:</span><br /> <textarea name="msg" cols="30" rows="6"></textarea> <br /> <br /> <input type="reset" value="Reset" /> <input type="submit" value="Send" /> </div> <div align="center"> <p> </p> </div> <?php $file = "guestbook.txt"; if (fopen($file, "r")) { $fil = "guestbook.txt"; $fo = fopen ($fil, "r"); $con = fread ($fo,filesize ($fil)); fclose ($fo); echo "$con"; } else { echo "<h3>Sorry there was an error please contact me.<h3>"; } ?> <!-- footer --> <div id="footer"> <div id="left_footer">© Copyright 2011<strong> Author </strong></div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> </div> </div> <!-- end footer --> </div> <!-- end main --> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <!-- header --> <div id="header"> <div id="logo"><a href="#">Header</a></div> <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">contact</a></li> <li><a href="#">Guestbook</a></li> </ul> <img src="images/twitter.png" height="49px;"/> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="text"> <h1><strong>Guestbook</strong></h1> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <?php CREATE TABLE `guestbook` (`Guest` INT(70) NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY, `Name` VARCHAR(65) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, `Message` VARCHAR(200) CHARACTER SET utf32 COLLATE utf32_bin NULL DEFAULT NULL, `Posted` VARCHAR(65) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_bin date_default_timezone_set('America/New_York'); date('h:i:s a'); $sql="INSERT INTO $guest(name,message, posted)VALUES('$name', '$msg', '$posted',)"; $result=mysql_query($sql); $file = "guestbook.txt"; $name = $_POST['name']; $posted =$_POST['posted']; $msg = $_POST['msg']; $msg = stripslashes($msg); $posted = stripslashes($posted); $name = stripslashes($name); $msg = nl2br(htmlentities($msg)); $posted = nl2br(htmlentities($posted)); $name = nl2br(htmlentities($name)); if (empty($name) || empty($msg)) { echo "<h3>Sorry all fields are required</h3>"; } else { $fp = fopen($file,"a"); $timestamp=date("M-d-Y h:m:s A"); fwrite($fp, ' <font size="3"> <BR><BR> Posted: '.$timestamp.'<br /> Name: '.$name.'<BR> <BR>Message: '.$msg.'<BR> '); fclose($fp); echo '<font size="3"><p align="center">Thank you '.$name.' for singing my guestbook</p></font>'; } ?> <div align="center"></div> <div align="center"></div> <div align="center"></div> <div align="center"></div> <p align="center"><a href="guestbook.php">Back to GuestBook</a></p> <div align="center"></div> </div> <!-- footer --> <div id="footer"> <div id="left_footer">© Copyright 2011<strong> Author </strong></div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> </div> </div> <!-- end footer --> </div> <!-- end main --> </body> </html>
  7. No, there are no other tables. And the colons where I have Guest, Name, and Message?
  8. I just want to make sure that I've done this right, this is my first time in awhile making a database for a website. CREATE TABLE `guests` ( `Guest:` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `Name:` VARCHAR( 80 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL , `Message:` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
  9. Just wondering, which is better php databases or sql? I have phpMyAdmin and I've that you can convert the database into php scripts?
  10. I have a guestbook that writes an entry to a text file, but when I first run it I get this error: Warning: fread() [function.fread]: Length parameter must be greater than 0 in C:\xampp\htdocs\xampp\index.php on line 66 Is there a way I can get rid of that error and still be able to use my guestbook until I actual update my guestbook using a database?
  11. use margin-top or margin-bottom to separate your divs instead of breaks.. and the code that you wrote looks good in clearing the divs.. as long as that is your parent div that contains the floating divs.. clear:both is acceptable but in my opinion is an older practice.. And the margin-to/margin-bottom goes in the css correct? It turns out that I put my clear div in the wrong. I thought I had my floating divs in the main div, turns out I have them in the text div. answer to your question = yes Thanks! I think I got it.
  12. use margin-top or margin-bottom to separate your divs instead of breaks.. and the code that you wrote looks good in clearing the divs.. as long as that is your parent div that contains the floating divs.. clear:both is acceptable but in my opinion is an older practice.. And the margin-to/margin-bottom goes in the css correct? It turns out that I put my clear div in the wrong. I thought I had my floating divs in the main div, turns out I have them in the text div.
  13. You need to connect each equivalency test with a logical operator (AND or OR). Also, this is just 1 part of managing and building a database. You have to first create the database/populate it with data/ etc. Before I get into building the database anymore, I dont have to link an admin name or password into the database?
  14. To make sure that I am understanding how to build a database, would I go about it like: SELECT * FROM user_table WHERE name=’$name’ email=’$email’ site="$site' AND msg="$msg"
  15. date_default_timezone_set() date() For the timezone, do I need to put something in the function? I was reading the tutorial and there are some examples that do have something in the function.
  16. How can I use margins instead of breaks? I've always used breaks and didnt know you could use margins. Also, before I go adjusting my CSS would I do the following to clear the divs. #main { background: url(images/body_all_bckg.jpg) repeat-y top center; } #content { width:780px; margin:0 auto; overflow:hidden; }
  17. I have the outcome, but I think I may have used too many divs. as well as inline styling and in doing so I've had to adjust image. I am trying to get my image also at a width of 370px and a height of 226px. In short, I trying to get an image floated to the left and two paragraphs to the right. How can I clean up my code a little better? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <!-- header --> <div id="header"> <div id="logo"><a href="#">Header</a></div> <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">contact</a></li> <li><a href="#">Guestbook</a></li> </ul> <img src="images/twitter.png" height="49px;"/> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="text"> <h1><strong>Welcome</strong></h1> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <div style="float: left;"> <img src="images/test.jpg" width="304px;" height="285px;"/></div> <div style="float: right; width: 220px; margin-right: 5px;"> <h2>Header</h2> <p> This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. </p> </div> <div style="float: right; width: 20px; margin-right: 6px;"> <img src="images/div103.gif" height="200px;"/></div> <div style="float: right; width: 220px; margin-right:5px;"> <h2>Header</h2> <p> This is our left text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. This is our right text column. </p> </div> <div style="clear: both;"> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> </div> <!-- footer --> <div id="footer"> <div id="left_footer">© Copyright 2011<strong> Author </strong></div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> </div> </div> <!-- end footer --> </div> <!-- end main --> </body> </html> /* body */ body { margin:114px 0 0 0; line-height:16px; font-family: Tahoma, Arial; background: url(images/body_top_bckg.jpg) no-repeat center top #171c20; color:#bed7e6; font-size:11px; } a { color:#018BC1; } a:hover { text-decoration:none; } #header {} #logo { padding:30px 0 120px 0; color:#fff; text-align:center; } /* logo */ #logo a{ color:#fff; text-decoration:none; font-weight:bold; font-size:24px; text-transform:uppercase; } /* Menu */ #menu { color:#fff; text-align:center; margin-bottom:62px; } #menu ul { text-align:center; list-style:none; padding:0; } #menu ul li { display:inline } #menu ul a { font-weight:bold; font-size:14px; text-decoration:none; color:#fff; background-color:#445d6c; padding:0 10px 2px 10px; } #menu ul a:hover { background-color:#f26513; } /* Main */ #main { background: url(images/body_all_bckg.jpg) repeat-y top center; } #content { width:780px; margin:0 auto; } / * Text */ #text { float: left; width: 780px; } #text p { margin:7px 0 7px 0; } #text li { background:url(images/li.gif) no-repeat 0px 7px; } h1 { margin:30px 0 0 0; padding:5px 0 7px 45px; text-transform:uppercase; font-size:24px; color:#fff; background:url(images/h1_bckg.jpg) no-repeat; float:left; } /* Footer */ #footer { background:url(images/footer_bckg.jpg) no-repeat top center; height:102px; clear:both; width:780px; margin:0 auto; } #left_footer { float:left; padding:60px 0 0 30px; color:#fff; font-size:12px; } #left_footer a { color:#fff; } #left_footer a:hover { text-decoration:none; } #right_footer { float:right; padding:60px 30px 0 0; color:#fff; font-size:12px; text-align:right; } #right_footer a { color:#fff; } #right_footer a:hover { text-decoration:none; } #content .inner_copy { border:0;color:#f00; float:left; width:50%!important; margin:-202px 0 0 0; overflow:hidden; line-height:0; padding:0; font-size:12px } /* Floats */ #leftFloat { float: left; width: 100px; } #rightFloat { float: right; width: 100px; } /* gallery */ .row img { margin: 2px; border: 1px solid #0000ff; clear: both; width: 100px; height: 90px; margin-left:3px; } .first { float: right; text-align: center; } .last { border: 1px solid #ffffff; float: right; } .desc { text-align: center; font-weight: normal; width: 120px; margin: 10px; }
  18. I have a working guestbook, but adjusting the time is whats getting me. I am trying to get the time to change depending on the timezone. And I also trying to get the time in the format 1:00 PM, not 21:00. Then on a different note, how can I stop spamming and injections. Index page for guestbook <HTML> <HEAD> <style type="text/css"> <!-- .style1 {font-size: 12px} body,td,th { font-size: 14px; } a { font-size: 12px; } body { background-color: #CCCCCC; SCROLLBAR-FACE-COLOR: #0066FF; MARGIN: 0px; SCROLLBAR-HIGHLIGHT-COLOR: #0066FF; SCROLLBAR-SHADOW-COLOR: #0066FF; SCROLLBAR-3DLIGHT-COLOR: #0066FF; SCROLLBAR-ARROW-COLOR: #51B0F2; SCROLLBAR-TRACK-COLOR: #51B0F2; Courier New; SCROLLBAR-DARKSHADOW-COLOR: #000000 } a:link { color: #0066FF; text-decoration: none; } a:visited { text-decoration: none; color: #0066FF; } a:hover { text-decoration: underline; color: #0066FF; } a:active { text-decoration: none; } --> </style> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><BODY> <form method="post" action="addguestbook.php"> <div align="center"></div> <div align="center"></div> <div align="center" class="style1"></div> <div align="center"><span class="style1">Name:</span><br /> <input name="name" type="text" size="30" maxlength="40" /> <br /> <span class="style1"><br /> Email:</span><br /> <input name="email" type="text" size="30" maxlength="40" /> <br /> <br /> <span class="style1">Home Page:</span><br /> <input name="site" type="text" size="30" value="http://" maxlength="40" /> <br /> <br /> <span class="style1">Message:</span><br /> <textarea name="msg" cols="22" rows="6"></textarea> <br /> <br /> <input type="reset" value="Reset" /> <input type="submit" value="Send" /> </div> <div align="center"> <p> </p> <?php $file = "guestbook.txt"; if (fopen($file, "r")) { $fil = "guestbook.txt"; $fo = fopen ($fil, "r"); $con = fread ($fo,filesize ($fil)); fclose ($fo); echo "$con"; } else { echo "<h3>Sorry there was an error please contact us now<h3>"; } ?></div> </BODY> </HTML> addguestbook.php <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"> <!-- body,td,th { font-size: 12px; color: #000000; } a:link { text-decoration: none; color: #0066FF; } a:visited { text-decoration: none; color: #0066FF; } a:hover { text-decoration: underline; color: #0066FF; } a:active { text-decoration: none; } body { background-color: #CCCCCC; SCROLLBAR-FACE-COLOR: #0066FF; MARGIN: 0px; SCROLLBAR-HIGHLIGHT-COLOR: #0066FF; SCROLLBAR-SHADOW-COLOR: #0066FF; SCROLLBAR-3DLIGHT-COLOR: #0066FF; SCROLLBAR-ARROW-COLOR: #51B0F2; SCROLLBAR-TRACK-COLOR: #51B0F2; Courier New; SCROLLBAR-DARKSHADOW-COLOR: #000000 } --> </style> </HEAD> <BODY> <?php function is_leapyear($year = 2004) { return ($year%4)==0; } $file = "guestbook.txt"; $name = $_POST['name']; $email = $_POST['email']; $site = $_POST['site']; $msg = $_POST['msg']; $site = stripslashes($site); $msg = stripslashes($msg); $email = stripslashes($email); $name = stripslashes($name); $msg = str_replace ("<","<",$msg); $msg = str_replace ("\n","<br>",$msg); $site = str_replace ("<","<",$site); $site = str_replace ("\n","<br>",$site); $email = str_replace ("<","<",$email); $email = str_replace ("\n","<br>",$email); $name = str_replace ("<","<",$name); $name = str_replace ("\n","<br>",$name); if(empty($email) || empty($name) || empty($msg)) { echo "<h3>Sorry all fields are required</h3>"; } else { $fp = fopen($file,"a"); $timestamp=date("M/D/Y h:m:s"); fwrite($fp, ' <font size="3"> <BR><BR> Posted: '.$timestamp.'<br /> Name: '.$name.'<BR> Email: <a href="mailto:'.$email.'">'.$email.'</a><BR> Home Page: <a href="'.$site.'">'.$site.'</a><BR>Message: '.$msg.'<BR> '); fclose($fp); echo '<font size="3"><p align="center">Thank you '.$name.' for singing my guestbook</p></font>'; } ?> <div align="center"></div> <div align="center"></div> <div align="center"></div> <div align="center"></div> <p align="center"><a href="index.php">Back to GuestBook</a></p> <div align="center"></div> </BODY> </HTML>
  19. Thanks for the help! Works like it should.
  20. The exit should be like this right? <?PHP //Then outside the processing script add If (isset($_GET['thankyou'])){ echo "Thank you for your email!<br/><br/>"; } exit(); ?>
  21. Ok, I think I may have got it now. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact</title> <link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <!-- header --> <div id="header"> <div id="logo"><a href="#">Header</a></div> <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Guestbook</a></li> </ul> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="text"> <h1><strong>Contact</strong></h1> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <?php if (isset($_POST['Submit'])) { if ($_POST['name'] != "") { $_POST['name'] = filter_var($_POST['name'], FILTER_SANITIZE_STRING); if ($_POST['name'] == "") { $errors .= 'Please enter a valid name.<br/><br/>'; } } else { $errors .= 'Please enter your name.<br/>'; } if ($_POST['email'] != "") { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors .= "$email is <strong>NOT</strong> a valid email address.<br/><br/>"; } } else { $errors .= 'Please enter your email address.<br/>'; } if ($_POST['message'] != "") { $_POST['message'] = filter_var($_POST['message'], FILTER_SANITIZE_STRING); if ($_POST['message'] == "") { $errors .= 'Please enter a message to send.<br/>'; } } else { $errors .= 'Please enter a message to send.<br/>'; } if (!$errors) { $first_name=$_POST['name']; $email_address=$_POST['email']; $subject = 'Email Submission'; $message=$_POST['message']; mail("myemailaddress@gmail.com","$subject", $message,"From: $first_name <$email_address>"); echo "Thank you for your email!<br/><br/>"; } else { echo '<div style="color: red">' . $errors . '<br/></div>'; } } ?> <?PHP header("Location:contact.php?thankyou"); //Then outside the processing script add If (isset($_GET['thankyou'])){ echo "Thank you for your email!<br/><br/>"; } ?> <form name="form1" method="post" action="contact.php"> Name: <br/> <input type="text" name="name" value="<?php echo $_POST['name']; ?>" size="50" /><br/><br/> Email Address: <br/> <input type="text" name="email" value="<?php echo $_POST['email']; ?>" size="50"/> <br/><br/> Message: <br/> <textarea name="message" rows="5" cols="50"><?php echo $_POST['message']; ?></textarea> <br/> <input type="Submit" name="Submit" value="Submit"/> <input type="Reset" name="Reset" value="Reset"/> </form> <!-- footer --> <br/> <br/> <br/> <div id="footer"> <div id="left_footer">© Copyright 2011<strong> Author </strong></div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> <!-- end footer --></div> <!-- end main --></div> </body> </html>
  22. Just to make sure I am placing it in the right spot. Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact</title> <link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <!-- header --> <div id="header"> <div id="logo"><a href="#">Header</a></div> <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Guestbook</a></li> </ul> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="text"> <h1><strong>Contact</strong></h1> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <?php if (isset($_POST['Submit'])) { if ($_POST['name'] != "") { $_POST['name'] = filter_var($_POST['name'], FILTER_SANITIZE_STRING); if ($_POST['name'] == "") { $errors .= 'Please enter a valid name.<br/><br/>'; } } else { $errors .= 'Please enter your name.<br/>'; } if ($_POST['email'] != "") { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors .= "$email is <strong>NOT</strong> a valid email address.<br/><br/>"; } } else { $errors .= 'Please enter your email address.<br/>'; } if ($_POST['message'] != "") { $_POST['message'] = filter_var($_POST['message'], FILTER_SANITIZE_STRING); if ($_POST['message'] == "") { $errors .= 'Please enter a message to send.<br/>'; } } else { $errors .= 'Please enter a message to send.<br/>'; } if (!$errors) { $first_name=$_POST['name']; $email_address=$_POST['email']; $subject = 'Email Submission'; $message=$_POST['message']; mail("myemailaddress@gmail.com","$subject", $message,"From: $first_name <$email_address>"); header("Location:contact.php?thankyou"); If (isset($_GET['thankyou')){ echo "Thank you for your email!<br/><br/>"; } } else { echo '<div style="color: red">' . $errors . '<br/></div>'; } } ?> <form name="form1" method="post" action="contact.php"> Name: <br/> <input type="text" name="name" value="<?php echo $_POST['name']; ?>" size="50" /><br/><br/> Email Address: <br/> <input type="text" name="email" value="<?php echo $_POST['email']; ?>" size="50"/> <br/><br/> Message: <br/> <textarea name="message" rows="5" cols="50"><?php echo $_POST['message']; ?></textarea> <br/> <input type="Submit" name="Submit" value="Submit"/> <input type="Reset" name="Reset" value="Reset"/> </form> <!-- footer --> <br/> <br/> <br/> <div id="footer"> <div id="left_footer">© Copyright 2011<strong> Author </strong></div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> <!-- end footer --></div> <!-- end main --></div> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.