wilcyn Posted June 30, 2007 Share Posted June 30, 2007 I am pretty good at reading HTML and I get basic PHP coding, but I'm trying to figure out how to configure a PHP file given to me as part of a template. My website is: http://www.wilcyn.com If you click on the 4th picture down, it will go to the Guestbook portion. If you fill in the information and click on submit, it appears to access a PHP file called "contact.php". I'm not really sure how the PHP file is configured. Ideally I'd want it to automatically update the entries on the guestbook page as they're submitted. At least that's what I assumed when the code was given to me along with the template for the overall page. I doubt it does that though and I would be more than fine if the results of the answers were emailed to me to go back and manually enter entries later. Which is where I need the help of a PHP expert. Please take a look at the following code and tell me what I have to change in order for this to work. Thanks. <? Error_Reporting(E_ALL & ~E_NOTICE); while ($request = current($_REQUEST)) { if (key($_REQUEST)!='recipient') { $pre_array=split ("&777&", $request); $post_vars[key($_REQUEST)][0]=$pre_array[0]; $post_vars[key($_REQUEST)][1]=$pre_array[1]; } next($_REQUEST); } reset($post_vars); $subject="From ".$post_vars['your_name'][0] ; $headers= "From: ".$post_vars['your_email'][0] ."\n"; $headers.='Content-type: text/html; charset=iso-8859-1'; $message=''; while ($mess = current($post_vars)) { if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) { $message.="<strong>".$mess[1]."</strong> ".$mess[0]."<br>"; } next($post_vars); } mail($_REQUEST['recipient'], $subject, " <html> <head> <title>Contact letter</title> </head> <body> <br> ".$message." </body> </html>" , $headers); echo ("Your message was successfully sent!"); ?> <script> resizeTo(300, 300); </script> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 30, 2007 Share Posted June 30, 2007 That code is sending an email to the email address provided in the Email field when you fill in the form on the guestbook. It is not being added to your guestbook database - I assume you are using some form a database to store the guestbook entries. If you are using a database you will need to recode that page. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.