justspiffy Posted January 23, 2008 Share Posted January 23, 2008 Hi there. Im having a problem with a simple 3 field form. I would like it so when you hit submit, it returns to the same page it was on before you hit submit. Is this possible? What i have right now, when you click on submit, only some of the page shows up. Here is the link to the page http://www.justspiffy.ca/shackletons/auction/index.php Here is the code <html> <head> <meta name="Keywords" content="SHACKLETON AUCTION, , shackleton auction, stratford, ontario, shopping, auctions, auctions, buy, sell, estate sales, estate, sale, public auction, estate auction, canadian auction, canadian auctions, auction, auctions, antiques, collectibles, paintings, art, watches, clocks, jewellery, diamonds, bronzes, porcelains, furniture, coins, stamps, Rolex, Patek Philippe, Canadian paintings, European paintings, Group of Seven, Group of 7, Lladros, Hummel, Royal Doulton, Cartier, Tiffany, Maitland Smith, Chippendale, Brietling, african art, silverware, hand woven rugs, Persian rugs, vintage cars, Capodimonté, ivory, statues, classic, modern, religious icons, Empire auctions, sculptures, carpets, Surrey-House, gold, jewelerry, vases, urns, porcelain, jade, crystal, chandeliers, shopping"> <meta name="Description" content="shackleton auction stratford ontario"> <title>Welcome to SHACKLETON AUCTION</title> <link rel="stylesheet" href="styles_email.css" type="text/css"> <script language="JavaScript1.1"> <!-- // global vars var defaultDesc = "Welcome to SHACKLETON AUCTION"; var bookmarkAddress = "http://www.shackletons.ca/auction/index.html"; // addBookmark function addBookmark(){ if (window.external){ window.external.AddFavorite(bookmarkAddress, defaultDesc); } else { alert ("Sorry, but your browser doesn't support the add bookmark feature. Please click Bookmarks and then Add Bookmark to add this site to your favorites."); } } function rotatePics(){ } //--> </script> <style type="text/css"> body { background-color: #ffffff; background-image: url(images/buttons/2699_shackleton_auction_backg-05.gif); background-repeat: no-repeat; background-attachment: scroll; background-position: top; } h1 { font-family: Arial, Helvetica, sans-serif; font-size: 14pt; font-weight: bold; font-style: italic; text-align: left; text-decoration: none; color: #000000; } h3 { font-family: ; font-size: pt; } p { font-family: Times New Roman, Times, serif; font-size: 12pt; font-weight: normal; font-style: normal; text-align: left; text-decoration: none; color: #000000; } ul { font-family: Times New Roman, Times, serif; font-size: 12pt; font-weight: normal; font-style: normal; text-align: left; text-decoration: none; color: #000000; } ol { font-family: Times New Roman, Times, serif; font-size: 12pt; font-weight: normal; font-style: normal; text-align: left; text-decoration: none; color: #000000; } a:link { font-family: Times New Roman, Times, serif; font-size: 12pt; font-weight: bold; font-style: normal; text-align: center; text-decoration: underline; color: #000000; } a:hover { font-family: Times New Roman, Times, serif; font-size: 12pt; font-weight: bold; font-style: normal; text-align: center; text-decoration: none; color: #F0B50F; } a:visited { font-family: Times New Roman, Times, serif; font-size: 12pt; font-weight: bold; font-style: normal; text-align: center; text-decoration: underline; color: #000000; } .companyInfo { font-family: Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: bold; font-style: normal; text-align: center; text-decoration: none; color: #000000; } .companyName { font-family: Arial, Helvetica, sans-serif; font-size: 30pt; font-weight: bold; font-style: normal; text-align: left; text-decoration: none; color: #000000; } .titleUnderline { color: #999999; border-bottom: thick groove; } .pictureBorder { border-right: thick groove #ffffff;border-left: thick groove #ffffff;border-top: thick groove #ffffff;border-bottom: thick groove #ffffff; } .logoBorder { border-right: thick none #ffffff;border-left: thick none #ffffff;border-top: thick none #ffffff;border-bottom: thick none #ffffff; } .style1 {color: #FFFFFF} </style> </head> <body onLoad="self.focus(true);"> <?php if ($_SERVER['REQUEST_METHOD'] != 'POST'){ $me = $_SERVER['PHP_SELF']; ?> <table border="0" cellpadding="5" cellspacing="0" align="center" width="700"> <!-- Header Section --> <tr> <td valign="top" colspan="2" width="100%"> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td valign="top" align="center"> <img src="images/buttons/2699_shackleton_auction_02.gif" border="0" class="logoBorder"> </td> </tr> </table> </td> </tr> <!--// Header Section Ends --> <!-- Top Menu Section --> <!--// Top Menu Section Ends --> <!-- Center Content Section --> <tr> <!-- Center Menu Section --> <td valign="top"> <table width="200" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="200" height="50"> <!-- May 26, 2006<td width="200" height="50" onMouseOver="this.style.cursor='hand';" onClick="window.location='retailer_details12_internal.asp?id=2699&menuid=6';">--> <img src="images/buttons/2699_shackleton_upcomming.gif" border="0" alt="Upcoming Actions"> <!--<img src="images/buttons/2699_shackleton_upcomming.gif" border="0" width="200" height="50" alt="Upcoming Actions">--> </td> </tr> <tr> <td width="200" height="50"> <!-- May 26, 2006<td width="200" height="50" onMouseOver="this.style.cursor='hand';" onClick="window.location='retailer_details12_internal.asp?id=2699&menuid=7';">--> <img src="images/buttons/2699_shackleton_services.gif" border="0" alt="Services"> <!--<img src="images/buttons/2699_shackleton_services.gif" border="0" width="200" height="50" alt="Services">--> </td> </tr> <tr> <td width="200" height="50" > <!-- May 26, 2006<td width="200" height="50" onMouseOver="this.style.cursor='hand';" onClick="window.location='retailer_details12_internal.asp?id=2699&menuid=8';">--> <img src="images/buttons/2699_shackleton_auction_09.gif" border="0" alt="Auction Centre"> <!--<img src="images/buttons/2699_shackleton_auction_09.gif" border="0" width="200" height="50" alt="Auction Centre">--> </td> </tr> <tr> <td width="200" height="50"> <!-- May 26, 2006<td width="200" height="50" onMouseOver="this.style.cursor='hand';" onClick="window.location='retailer_details12_internal.asp?id=2699&menuid=9';">--> <img src="images/buttons/2699_shackleton_auction_10.gif" border="0" alt="About Us"> <!--<img src="images/buttons/2699_shackleton_auction_10.gif" border="0" width="200" height="50" alt="About Us">--> </td> </tr> <tr> <td width="200" height="50" > <!-- May 26, 2006<td width="200" height="50" onMouseOver="this.style.cursor='hand';" onClick="window.location='mailto:shack@shackletons.ca';">--> <img src="images/buttons/2699_shackleton_auction_11.gif" border="0" alt="Contact Us"> <!--<img src="images/buttons/2699_shackleton_auction_11.gif" border="0" width="200" height="50" alt="Contact Us">--> </td> </tr> <tr> <td width="200" height="50"> <!-- May 26, 2006<td width="200" height="50" onMouseOver="this.style.cursor='hand';" onClick="window.location='http://www.citiesandtowns.ca/retailer_details12.asp?id=2699';">--> <img src="images/buttons/2699_shackleton_auction_12.gif" border="0" alt="Home"> <!--<img src="images/buttons/2699_shackleton_auction_12.gif" border="0" width="200" height="50" alt="Home">--> </td> </tr> </table> </td> <!--// Center Menu Section Ends --> <!-- Page Content Section --> <td valign="top" align="left" width="600" height="100%" > <table width="100%"> <tr> <td valign="top" align="left" ><TABLE width=620 border=0> <TBODY> <TR> <TD width=20> </TD> <TD> <TABLE borderColor=#f0b50f width=520 border=2> <TBODY> <TR> <TD vAlign=top align=middle background=http://www.citiesandtowns.ca/images/customPages/graphics/Z66_shackleton_auction_09.gif><IMG style="BORDER-LEFT-COLOR: #f0b50f; BORDER-BOTTOM-COLOR: #f0b50f; BORDER-TOP-COLOR: #f0b50f; BORDER-RIGHT-COLOR: #f0b50f" height=302 src="images/buttons/Real_Estate_&_Auction_Centre.jpg" width=496 border=2> <BR> <BR><FONT face="Times New Roman, Times, serif" size=4><STRONG><FONT color=#000000>At Shackleton's, we can sell your home and EVERYTHING in it!</FONT> <BR></STRONG></FONT><BR><FONT face="Times New Roman, Times, serif" size=4><STRONG>Serving Perth County area for over 25 years.</STRONG></FONT></TD></TR></TBODY></TABLE></TD></TR> <TR> <TD width=20> </TD> <TD align=middle><FONT face="Times New Roman, Times, serif" size=4><STRONG><br> Want to know more about our auctions?<BR> Please, fill out the form below and we'll notify you about upcoming sales.</STRONG></FONT></TD></TR></TBODY></TABLE><!--<BR><A href="http://www.citiesandtowns.ca/retailer_details12_internal.asp?id=2699&menuid=13">test</A> --> </td> </tr> <!--email template--> <tr> <td align="center"> <form name="form1" method="post" action="index.php"><table style="BORDER-RIGHT: #444444 2px solid; BORDER-TOP: #444444 2px solid; BORDER-LEFT: #444444 2px solid; BORDER-BOTTOM: #444444 2px solid; background-color:#cccccc" width="280" BORDER=0 CELLPADDING=0 CELLSPACING=0> <tr> <td align="center" colspan="2" bgcolor="#444444"> <p style="text-align: center;font-family: Arial, Helvetica, sans-serif; font-size: 10pt;font-weight: bold;color: #ffffff;">Join our E-List</p></td> </tr> <tr> <td width="132" style="font-family: Arial, Helvetica, sans-serif; font-size: 8pt;text-align: left;"><div align="left">Your First Name: </div></td> <td width="144"> <div align="left"> <input name="first" type="text" id="first"> </div></td> </tr> <tr> <td style="font-family: Arial, Helvetica, sans-serif; font-size: 8pt;text-align: left;"><div align="left">Your Last Name:</div></td> <td> <div align="left"> <input name="last" type="text" id="last"> </div></td> </tr> <tr> <td style="font-family: Arial, Helvetica, sans-serif; font-size: 8pt;text-align: left;"><div align="left">Your E-Mail:</div></td> <td height="22" valign="top"><label> <input name="email" type="text" id="email"></label></td> </tr> <tr> <td height="32" colspan="2"> <div align="center"> <strong><span class="style1"> <input type="submit" name="Submit" value="Submit Comment"> <input type="reset" name="Submit2" value="Clear Form"> </span></strong><br> </div></td> </tr> </table> </form> <?php } else { error_reporting(0); $recipient = 'contact@justspiffy.ca'; $email = stripslashes($_POST['email']); $from = stripslashes($_POST['name']); $frlast = stripslashes($_POST['last']); $headers = "From: $email\r\n\r\n"; $subject = "E-List"; $message = "Name: $from\r\n Last Name: $frlast\r\n Email Address: $email\r\n "; mail($recipient, $subject, $message, $headers); if (!mail) { echo "Message failed to send"; } else { echo nl2br (); } } ?> </td> </tr> <!--email templates ends--> <tr> <td> <!-- Properties Header Section --> <table > </table> <!--// Properties Header Section Ends --> <br> <!-- Properties Listing Section --> <!--// Properties Listing Section Ends --> </td> </tr> </table> </td> <!--// Page Content Section Ends --> </tr> <tr> <td width="100%" align="center" colspan="2"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr id="tableRow"> </tr> </table> </td> </tr> <!--// Professionals List Ends --> <tr> <td colspan="2"> </td> </tr> </table> <table align="center" width="700" border="0" cellpadding="0" cellspacing="0"> <tr> <td nowrap align="center"> </td> </tr> <tr> <td align="center" valign="top"> <!-- nested table --> <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center"> <tr> <td align="center"> <a href='index.php' style=''>HOME</a> <br> </td> </tr> <tr> <td align="center"> <map name="bottomBarMap"> <area alt="" shape="circle" coords="346,43,15" href="javascript:addBookmark()"> </map> </td> </tr> </table> <!-- close nested table --> </td> </tr> <tr> <td align="center"> <p style="font-weight: bold; text-align: center;">This site visited 41918 times.</p> </td> </tr> <tr> <td align="center"> </td> </tr> </table> <table align="center" border="0" width="700"> <tr> <td align="center"> <br><br> <p style="font-family: arial, helvetica, sans-serif; font-size: 7 pt; font-style: normal;">The material posted on the site is solely for informational purposes and is not a substitute for professional advice. Please contact us if you have specific questions or concerns.</p> </td> </tr> </table> </body> </html> (edited to add the tags) Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/ Share on other sites More sharing options...
kenrbnsn Posted January 23, 2008 Share Posted January 23, 2008 No one is going to look at all that code. Please reduce it down to the relevant section and post that. Ken Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446655 Share on other sites More sharing options...
priti Posted January 23, 2008 Share Posted January 23, 2008 hi, if ($_SERVER['REQUEST_METHOD'] != 'POST'){ $me = $_SERVER['PHP_SELF']; ?> you are using this condition in the start itself so page is getting displayed like this. when you are posting your code the else part is getting executed and the remaining html is been shown to you. Regards Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446656 Share on other sites More sharing options...
justspiffy Posted January 23, 2008 Author Share Posted January 23, 2008 sorry.. here is just the form and the php <?php if ($_SERVER['REQUEST_METHOD'] != 'POST'){ $me = $_SERVER['PHP_SELF']; ?> <form name="form1" method="post" action="index.php"><table style="BORDER-RIGHT: #444444 2px solid; BORDER-TOP: #444444 2px solid; BORDER-LEFT: #444444 2px solid; BORDER-BOTTOM: #444444 2px solid; background-color:#cccccc" width="280" BORDER=0 CELLPADDING=0 CELLSPACING=0> <tr> <td align="center" colspan="2" bgcolor="#444444"> <p style="text-align: center;font-family: Arial, Helvetica, sans-serif; font-size: 10pt;font-weight: bold;color: #ffffff;">Join our E-List</p></td> </tr> <tr> <td width="132" style="font-family: Arial, Helvetica, sans-serif; font-size: 8pt;text-align: left;"><div align="left">Your First Name: </div></td> <td width="144"> <div align="left"> <input name="first" type="text" id="first"> </div></td> </tr> <tr> <td style="font-family: Arial, Helvetica, sans-serif; font-size: 8pt;text-align: left;"><div align="left">Your Last Name:</div></td> <td> <div align="left"> <input name="last" type="text" id="last"> </div></td> </tr> <tr> <td style="font-family: Arial, Helvetica, sans-serif; font-size: 8pt;text-align: left;"><div align="left">Your E-Mail:</div></td> <td height="22" valign="top"><label> <input name="email" type="text" id="email"></label></td> </tr> <tr> <td height="32" colspan="2"> <div align="center"> <strong><span class="style1"> <input type="submit" name="Submit" value="Submit Comment"> <input type="reset" name="Submit2" value="Clear Form"> </span></strong><br> </div></td> </tr> </table> </form> <?php } else { error_reporting(0); $recipient = 'contact@justspiffy.ca'; $email = stripslashes($_POST['email']); $from = stripslashes($_POST['name']); $frlast = stripslashes($_POST['last']); $headers = "From: $email\r\n\r\n"; $subject = "Join Our E-List"; $message = "Name: $from\r\n Last Name: $frlast\r\n Email Address: $email\r\n "; mail($recipient, $subject, $message, $headers); if (!mail) { echo "Message failed to send"; } else { echo nl2br (); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446659 Share on other sites More sharing options...
legohead6 Posted January 23, 2008 Share Posted January 23, 2008 just dont put a taget on the form, make sure its method is post, then use a if(isset($_POST['submitbutton'])){ Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446661 Share on other sites More sharing options...
priti Posted January 23, 2008 Share Posted January 23, 2008 hi, Is your problem solved? if not then what is your expected output what should happen when you submit your form and mail is sent. Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446673 Share on other sites More sharing options...
justspiffy Posted January 23, 2008 Author Share Posted January 23, 2008 no it is not yet solved. i tried putting the if(isset($_POST['submitbutton'])){ command in and it would only show the background a image and the HOME link but at the top of the page. what i would like to happen, is when you click on submit, it takes you to the exact same page it came from.. it doesnt show any confirmation of message sent or anything. just redirects back to the exact same page you came from... Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446679 Share on other sites More sharing options...
priti Posted January 23, 2008 Share Posted January 23, 2008 okie remove <?php if ($_SERVER['REQUEST_METHOD'] != 'POST'){ $me = $_SERVER['PHP_SELF']; ?> from start we won't keep html form to be in if else condition. 2. if(isset($_POST)) { //write your mail code on the same page error_reporting(0); $recipient = 'contact@justspiffy.ca'; $email = stripslashes($_POST['email']); $from = stripslashes($_POST['name']); $frlast = stripslashes($_POST['last']); $headers = "From: $email\r\n\r\n"; $subject = "Join Our E-List"; $message = "Name: $from\r\n Last Name: $frlast\r\n Email Address: $email\r\n "; mail($recipient, $subject, $message, $headers); if (!mail) { echo "Message failed to send"; } else { echo nl2br (); } } 3.in your form tag <form action="<?php echo $_SERVER['PHP_SELF'];?>"> use this. 4.then tell us weather you are able to achieve it or not. i still don't understand why you are writing you HTML in if() condition?? anywayz try these and see if it solves Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446879 Share on other sites More sharing options...
justspiffy Posted January 23, 2008 Author Share Posted January 23, 2008 thanks for you reply. what you suggested works great, it returns to the page that it came from however, when the form is filled out and emailed, the email does not show what the person had filled out in the form. here is the email i receive once the form is submitted Name: Last Name: Email Address: the fields are empty, even though the form was correctly filled out. any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446918 Share on other sites More sharing options...
justspiffy Posted January 23, 2008 Author Share Posted January 23, 2008 I also forgot to mention, sometimes when the form is submitted, i receive 3 or 4 of the same email. other times i just receive one copy of it. strange! Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-446922 Share on other sites More sharing options...
priti Posted January 24, 2008 Share Posted January 24, 2008 Hmm.... Good that you are able to part 1 of your problem now the next in problem dish is content of your mails are missing so try to echo it and see what $message is . do as follow before this echo $message exit; mail($recipient, $subject, $message, $headers); and try to lookin what your message is. for mail header and mail function read:http://in2.php.net/manual/en/function.mail.php Regards Quote Link to comment https://forums.phpfreaks.com/topic/87326-form-set-to-submit-to-itself-only-showing-background/#findComment-447538 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.