Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Coding Help?

    Hello,
    First off, let me say that I know barely anything about PHP. A friend of mine had his site go down do to someone backing their site and changing on their links to link to a different website. They needed assistance loading the backup and trying to get the site going. I was able to load the back up and get everything pretty much functioning. However, the one item I wasn't able to get their contact us form back up. It already has the PHP coding listed and there is a php form that is uploaded to the site, however, it appears something is off because it doesn't appear to be working. Their website with the form is: http://www.villaoasiscozumel.com/contact.htm?#

    The link for the php part of the website is http://www.villaoasiscozumel.com/reservationrequest.php

    If you need me to post the actual code I can. I just know nothing about this stuff and was just trying to help them get the folders loaded back on the site. Thanks for your help.

    Kevin

  • #2
    Regular Coder
    Join Date
    Dec 2010
    Location
    London
    Posts
    339
    Thanks
    63
    Thanked 11 Times in 11 Posts
    Yes, you need to post the code for pages relating to the contact form, and explain what 'doesn't appear to be working'.

  • #3
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code

    Thanks, I will post the code. A different user let me know that my page should be titled .php instead of .htm. I changed it and that seemed to make the submit button submit over to what would be the confirmation page, however, the information still didn't make it to an e-mail that I had assigned.

    Here is the code for the page with the form:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <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>
    
    <table class="main_table" align="center">
    	<tr>
    		<!--€€€€€€€€€€€€€€€€€€€€€FLASH€€€€€€€€€€€€€€€€€€€€€v-->
    		<td>
    			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="755" height="377">
    											<param name="movie" value="testing.swf?button=3" /> 
    											<param name="quality" value="high" />
    											<param name="menu" value="false" />
    											<param name="wmode" value="transparent" />
    											<!--[if !IE]> <-->
    											<object data="testing.swf?button=3"
    													width="755" height="377" type="application/x-shockwave-flash">
    											 <param name="quality" value="high" />
    											 <param name="menu" value="false" />
    											 <param name="wmode" value="transparent" />
    											 <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
    											 FAIL (the browser should render some flash content, not this).
    											</object><!--> <![endif]-->
    		  </object>
    		</td>
    		<!--€€€€€€€€€€€€€€€€€€€€€FLASH€€€€€€€€€€€€€€€€€€€€€v-->
    	</tr>
    	<tr><td style="line-height:24px">&nbsp;</td></tr>
    	<tr>
    		<td>
    			<table>
    				<tr>
    					<td style="width:30px">&nbsp;</td>
    					<td style="width:218px">
    						<img src="http://www.codingforums.com/images/2t1.jpg" align="top" alt="" /><br /><br style="line-height:11px" />
    						<b>Ready to make a reservation </b><br /> 
    						Use the contact form to the right in order to to Reserve Villa Oasis.<br />
    <br style="line-height:16px" />
    						<b>Contact Information: </b><br />
    						Tel.:  1-214-890-7733<br />
    						Fax.:  1-(800)-123-1234<br />
    						E-mail: <a href="mailto:customer@companyname.com" class="lnk_1">inquiry@villaoasiscozumel.com</a><br />
    						<br />
    					</td>
    					<td style="width:30px">&nbsp;</td>
    					<td>
    						<form action="" enctype="multipart/form-data"  id="form" name="form" >
    						<table style="width:447px">
    							<tr>
    								<td colspan="2">
    									<img src="http://www.codingforums.com/images/2t2.jpg" align="top" alt="" /><br /><br style="line-height:13px" />
    								</td>
    							</tr>
    							<tr>
    								<td class="c">
    									Your Full Name Here:
    								</td>
    								<td><input type="text" class="input" /></td>
    							</tr>
    							<tr>
    								<td class="c">
    									E-Mail Address:
    								</td>
    								<td><input type="text" class="input" /></td>
    							</tr>
    							<tr>
    								<td class="c">
    									Home Phone:
    								</td>
    								<td><input type="text" class="input" /></td>
    							</tr>
    							<tr>
    								<td class="c">
    									Length of Stay:
    								</td>
    								<td><select class="slct">
    								  <option>1 day</option>
    								  <option>2 days</option>
    								  <option>3 days</option>
    								  <option>4 days</option>
    								  <option>5 days</option>
    								  <option>6 days</option>
    								  <option>7 days</option>
    								  <option>8 days</option>
    								  <option>9 days</option>
    								  <option>10 days</option>
    								  <option>11 days</option>
    								  <option>12 days</option>
    								  <option>13 days</option>
    								  <option>14 days</option>
    								  <option>more than 14</option>
    								</select> &nbsp; &nbsp; Number in Party: &nbsp; &nbsp; <select class="slct2">
    								  <option>1</option>
    								  <option>2</option>
    								  <option>3</option>
    								  <option>4</option>
    								  <option>5</option>
    								  <option>6</option>
    								  <option>7</option>
    								  <option>8</option>
    								  <option>9</option>
    								  <option>10</option>
    								  <option>more than 10</option>
    								</select></td>
    							</tr>
    							<tr>
    								<td class="c">
    									Arrival Date:
    								</td>
    								<td><select class="slct">
    								  <option>Month</option>
    								  <option>January</option>
    								  <option>February</option>
    								  <option>March</option>
    								  <option>April</option>
    								  <option>May</option>
    								  <option>June</option>
    								  <option>July</option>
    								  <option>August</option>
    								  <option>September</option>
    								  <option>October</option>
    								  <option>November</option>
    								  <option>December</option>
    								</select><select class="slct" style="margin:0px 20px 0px 23px;">
    								  <option>1</option>
    								  <option>2</option>
    								  <option>3</option>
    								  <option>4</option>
    								  <option>5</option>
    								  <option>6</option>
    								  <option>7</option>
    								  <option>8</option>
    								  <option>9</option>
    								  <option>10</option>
    								  <option>11</option>
    								  <option>12</option>
    								  <option>13</option>
    								  <option>14</option>
    								  <option>15</option>
    								  <option>16</option>
    								  <option>17</option>
    								  <option>18</option>
    								  <option>19</option>
    								  <option>20</option>
    								  <option>21</option>
    								  <option>22</option>
    								  <option>23</option>
    								  <option>24</option>
    								  <option>25</option>
    								  <option>26</option>
    								  <option>27</option>
    								  <option>28</option>
    								  <option>29</option>
    								  <option>30</option>
    								  <option>31</option>
    								</select><select class="slct2">
    								  <option>2014</option>
    								  <option>2015</option>
    								  <option>2016</option>
    								  <option>2017</option>
    								  <option>2018</option>
    								  <option>2019</option>
    								  <option>2020</option>
                                  </select></td>
    							</tr>
    							<tr>
    								<td class="c">
    									Additional Comments:
    								</td>
    								<td><textarea class="ta" cols="2" rows="2"></textarea></td>
    							</tr>
    							<tr>
    								<td height="36" class="c">&nbsp;</td>
    								<td>
    									<br style="line-height:13px" />
    									<a href="#" onClick="document.getElementById('form').reset()" class="rdmr" style="margin:0px 0px 0px 62px;">clear form</a><a href="reservationrequest.php" onClick="document.getElementById('form').submit()" class="rdmr" style="margin:0px 0px 0px 13px;">submit reservation request</a>
    								</td>
    							</tr>
    						</table>
    						</form>
    					</td>
    					<td style="width:30px">&nbsp;</td>
    				</tr>
    			</table>
    		</td>
    	</tr>
    	<tr><td style="line-height:25px">&nbsp;</td></tr>
    	<tr>
    		<td class="ftr nn">Copyright 2007 &copy; Villa Oasis. All rights reserved.  <a href="index-5.html">Privacy Policy</a></td>
    	</tr>
    </table>
    
    </body>
    </html>
    Here is the code for the confirmation page:
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Reservation Request</title>
    </head>

    <body>
    <?php
    if ($HTTP_POST_VARS['submit']) {
    $name=$HTTP_POST_VARS['name'];
    $email=$HTTP_POST_VARS['email'];
    $phone=$HTTP_POST_VARS['phone'];
    $length=$HTTP_POST_VARS['length'];
    $party=$HTTP_POST_VARS['party'];
    $month=$HTTP_POST_VARS['month'];
    $day=$HTTP_POST_VARS['day'];
    $year=$HTTP_POST_VARS['year'];
    $comments=$HTTP_POST_VARS['comments'];
    $to "kevinkeeley@gmail.com";
    $subject "Reservation Request";
    $body "Requests\n";
    $body.= "Name: $name\n";
    $body.= "Email: $email\n";
    $body.= "Phone: $phone\n";
    $body.= "Length of stay: $length\n";
    $body.= "Number in Party: $party\n";
    $body.= "Date: $month $day, $year\n";
    $body.= "Additional Comments: $comments\n";

    if (
    mail($to$subject$body)) {
      echo(
    "<p>Message successfully sent!</p>");
     } else {
      echo(
    "<p>Message delivery failed...</p>");
     }
     }
    ?>

    <p><a href="contact.htm">Return to Reservations Page</a></p>
    <div style="text-align: center"><script type="text/javascript"><!--

    </html>
    As I indicated, I don't really know anything about php and am just trying to help get it up for him. Thanks for your time!

    Kevin
    Last edited by Fou-Lu; 03-31-2014 at 06:08 PM.

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,211
    Thanks
    23
    Thanked 605 Times in 604 Posts
    Your submit button as well as the reset direct the form to the containing web page:
    Code:
    <a href="#" onClick="document.getElementById('form').submit()" 
    class="rdmr" 
    style="margin:0px 0px 0px 13px;">submit reservation request
    </a>
    If this is correct the page is not an HTML but PHP or ASP. See what is above the doctype. Or it should link to a different file.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #5
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Page

    Thanks for the help. I still can't seem to get it to submit correct. Here is the confirmation page which seems to have the directions for the submit code.
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Reservation Request</title>
    </head>

    <body>
    <?php
    if ($HTTP_POST_VARS['submit']) {
    $name=$HTTP_POST_VARS['name'];
    $email=$HTTP_POST_VARS['email'];
    $phone=$HTTP_POST_VARS['phone'];
    $length=$HTTP_POST_VARS['length'];
    $party=$HTTP_POST_VARS['party'];
    $month=$HTTP_POST_VARS['month'];
    $day=$HTTP_POST_VARS['day'];
    $year=$HTTP_POST_VARS['year'];
    $comments=$HTTP_POST_VARS['comments'];
    $to "kevinkeeley@gmail.com";
    $subject "Reservation Request";
    $body "Requests\n";
    $body.= "Name: $name\n";
    $body.= "Email: $email\n";
    $body.= "Phone: $phone\n";
    $body.= "Length of stay: $length\n";
    $body.= "Number in Party: $party\n";
    $body.= "Date: $month $day, $year\n";
    $body.= "Additional Comments: $comments\n";

    if (
    mail($to$subject$body)) {
      echo(
    "<p>Message successfully sent!</p>");
     } else {
      echo(
    "<p>Message delivery failed...</p>");
     }
     }
    ?>

    <p><a href="contact.htm">Return to Reservations Page</a></p>
    <div style="text-align: center"><script type="text/javascript"><!--

    </html>

    [B]Here is the code I have on the page that has the form[/B]
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <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>

    <table class="main_table" align="center">
        <tr>
            <!--€€€€€€€€€€€€€€€€€€€€€FLASH€€€€€€€€€€€€€€€€€€€€€v-->
            <td>
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="755" height="377">
                                                <param name="movie" value="testing.swf?button=3" /> 
                                                <param name="quality" value="high" />
                                                <param name="menu" value="false" />
                                                <param name="wmode" value="transparent" />
                                                <!--[if !IE]> <-->
                                                <object data="testing.swf?button=3"
                                                        width="755" height="377" type="application/x-shockwave-flash">
                                                 <param name="quality" value="high" />
                                                 <param name="menu" value="false" />
                                                 <param name="wmode" value="transparent" />
                                                 <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
                                                 FAIL (the browser should render some flash content, not this).
                                                </object><!--> <![endif]-->
              </object>
            </td>
            <!--€€€€€€€€€€€€€€€€€€€€€FLASH€€€€€€€€€€€€€€€€€€€€€v-->
        </tr>
        <tr><td style="line-height:24px">&nbsp;</td></tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td style="width:30px">&nbsp;</td>
                        <td style="width:218px">
                            <img src="http://www.codingforums.com/images/2t1.jpg" align="top" alt="" /><br /><br style="line-height:11px" />
                            <b>Ready to make a reservation </b><br /> 
                            Use the contact form to the right in order to to Reserve Villa Oasis.<br />
    <br style="line-height:16px" />
                            <b>Contact Information: </b><br />
                            Tel.:  1-214-890-7733<br />
                            Fax.:  1-(800)-123-1234<br />
                            E-mail: <a href="mailto:customer@companyname.com" class="lnk_1">inquiry@villaoasiscozumel.com</a><br />
                            <br />
                        </td>
                        <td style="width:30px">&nbsp;</td>
                        <td>
                            <form action="" enctype="multipart/form-data"  id="form" name="form" >
                            <table style="width:447px">
                                <tr>
                                    <td colspan="2">
                                        <img src="http://www.codingforums.com/images/2t2.jpg" align="top" alt="" /><br /><br style="line-height:13px" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="c">
                                        Your Full Name Here:
                                    </td>
                                    <td><input type="text" class="input" /></td>
                                </tr>
                                <tr>
                                    <td class="c">
                                        E-Mail Address:
                                    </td>
                                    <td><input type="text" class="input" /></td>
                                </tr>
                                <tr>
                                    <td class="c">
                                        Home Phone:
                                    </td>
                                    <td><input type="text" class="input" /></td>
                                </tr>
                                <tr>
                                    <td class="c">
                                        Length of Stay:
                                    </td>
                                    <td><select class="slct">
                                      <option>1 day</option>
                                      <option>2 days</option>
                                      <option>3 days</option>
                                      <option>4 days</option>
                                      <option>5 days</option>
                                      <option>6 days</option>
                                      <option>7 days</option>
                                      <option>8 days</option>
                                      <option>9 days</option>
                                      <option>10 days</option>
                                      <option>11 days</option>
                                      <option>12 days</option>
                                      <option>13 days</option>
                                      <option>14 days</option>
                                      <option>more than 14</option>
                                    </select> &nbsp; &nbsp; Number in Party: &nbsp; &nbsp; <select class="slct2">
                                      <option>1</option>
                                      <option>2</option>
                                      <option>3</option>
                                      <option>4</option>
                                      <option>5</option>
                                      <option>6</option>
                                      <option>7</option>
                                      <option>8</option>
                                      <option>9</option>
                                      <option>10</option>
                                      <option>more than 10</option>
                                    </select></td>
                                </tr>
                                <tr>
                                    <td class="c">
                                        Arrival Date:
                                    </td>
                                    <td><select class="slct">
                                      <option>Month</option>
                                      <option>January</option>
                                      <option>February</option>
                                      <option>March</option>
                                      <option>April</option>
                                      <option>May</option>
                                      <option>June</option>
                                      <option>July</option>
                                      <option>August</option>
                                      <option>September</option>
                                      <option>October</option>
                                      <option>November</option>
                                      <option>December</option>
                                    </select><select class="slct" style="margin:0px 20px 0px 23px;">
                                      <option>1</option>
                                      <option>2</option>
                                      <option>3</option>
                                      <option>4</option>
                                      <option>5</option>
                                      <option>6</option>
                                      <option>7</option>
                                      <option>8</option>
                                      <option>9</option>
                                      <option>10</option>
                                      <option>11</option>
                                      <option>12</option>
                                      <option>13</option>
                                      <option>14</option>
                                      <option>15</option>
                                      <option>16</option>
                                      <option>17</option>
                                      <option>18</option>
                                      <option>19</option>
                                      <option>20</option>
                                      <option>21</option>
                                      <option>22</option>
                                      <option>23</option>
                                      <option>24</option>
                                      <option>25</option>
                                      <option>26</option>
                                      <option>27</option>
                                      <option>28</option>
                                      <option>29</option>
                                      <option>30</option>
                                      <option>31</option>
                                    </select><select class="slct2">
                                      <option>2014</option>
                                      <option>2015</option>
                                      <option>2016</option>
                                      <option>2017</option>
                                      <option>2018</option>
                                      <option>2019</option>
                                      <option>2020</option>
                                  </select></td>
                                </tr>
                                <tr>
                                    <td class="c">
                                        Additional Comments:
                                    </td>
                                    <td><textarea class="ta" cols="2" rows="2"></textarea></td>
                                </tr>
                                <tr>
                                    <td height="36" class="c">&nbsp;</td>
                                    <td>
                                        <br style="line-height:13px" />
                                        <a href="#" onClick="document.getElementById('form').reset()" class="rdmr" style="margin:0px 0px 0px 62px;">clear form</a><a href="reservationrequest.php" onClick="document.getElementById('form').submit()" class="rdmr" style="margin:0px 0px 0px 13px;">submit reservation request</a>
                                    </td>
                                </tr>
                            </table>
                            </form>
                        </td>
                        <td style="width:30px">&nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr><td style="line-height:25px">&nbsp;</td></tr>
        <tr>
            <td class="ftr nn">Copyright 2007 &copy; Villa Oasis. All rights reserved.  <a href="index-5.html">Privacy Policy</a></td>
        </tr>
    </table>

    </body>
    </html>
    Any other thoughts? The actual website is villaoasiscozumel.com
    Last edited by Fou-Lu; 03-31-2014 at 06:09 PM.

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,327
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    No use of the [php]***YOUR CODE IN THESE[/php] tags here then eh?
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #7
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,211
    Thanks
    23
    Thanked 605 Times in 604 Posts
    The code on your page http://www.villaoasiscozumel.com/contact.htm seems to be correct, but it should be a PHP file and not a HTML. Please just copy and paste the code on http://www.villaoasiscozumel.com/con...om/contact.htm without changing it.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Had to wrap these so I can read them.
    Methinks something else has changed, particularly the PHP version. Register long arrays was deprecated in 5.3.0 and removed from the language in 5.4.0. Prior to 5.0.0 the 'long arrays' existed as remnants prior to 4.2.0 as pre-superglobal variants.
    $HTTP_POST_VARS no longer exists as of 5.4.0. Since 4.1.0 these should be using the superglobal variant $_POST. If that's not the cause, it will be sometime in the future, so you may as well correct that before it is.

    The actual problem is likely the lack of a form action. Clicking submit will go nowhere, and unless the page handles the self post that simply won't work. Given the two blocks of code provided, that leads me to believe there's two separate scripts here, which likely correspond to the two links provided in the original post.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •