Jump to content

form set to submit to itself only showing background


justspiffy

Recommended Posts

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ();

      }

}

  ?>

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.