html php form problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kevinb
Forum Newbie
Posts: 7
Joined: Sat Apr 03, 2004 6:04 pm

html php form problems

Post by kevinb »

feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


hi all,
i have inherited a web site with php form attached.
i am not a coder and no nothing of php.
my query is that the client states that he is not getting enquiries from overseas but has no problem with getting them from within australia.
i have no idea!
i made changes to the form input boxes renamed and added etc but did not change the code in any other way.
i thought if the form worked it worked!
any thoughts ideas most welcome in lay terms preferred.
not sure what to post to that may be relevant but the url is http://www.ginninderry.com.au 
i have also included the php from the enquire2 page:

Code: Select all

<?php
	  	if (($name == "") or ($phone == "") or ($email == "") or ($mobile == "") or ($NoRooms == "") or ($NoGuests == "") or ($NoNights == "") or ($arrival == "") or ($requests == ""))
		{
		print "<form name="contact" method="post" action="$PHP_SELF">
        <h1>Enquire or book online</h1>
		<p>You have not completed all required fields, please complete at least all fields marked with <font size="-1"><font color="#FF0066"><b>*</b></font></font>.</p>
        <table width="100%" border="0" cellspacing="1" cellpadding="1">
          <tr> 
            <td width="157">Name: </td>
            <td width="217"> <input type="text" name="name" value="$name" size="20"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td rowspan="2" width="116"><font size="-1"><font color="#FF0066"><b>*</b></font></font> 
              indicates a required field</td>
          </tr>
          <tr> 
            <td width="157">Phone:</td>
            <td width="217"> <input type="text" name="phone" value="$phone" size="20"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
          </tr>
          <tr> 
            <td width="157">Mobile:</td>
            <td width="217"> <input type="text" name="mobile" value="$mobile" size="20"> </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Email:</td>
            <td width="217"> <input type="text" name="email" value="$email" size="20"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">No of Rooms:</td>
            <td width="217"> <input type="text" name="NoRooms" value="$NoRooms" size="20"> </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">No of guests:</td>
            <td width="217"> <input type="text" name="NoGuests" value="$NoGuests" size="20"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">No of nights:</td>
            <td width="217"> <input type="text" name="NoNights" value="$NoNights" size="10"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Arrival date:</td>
            <td width="217"> <input type="text" name="arrival" value="$arrival" size="6"> </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Add'l requests<font size="-1"><font color="#FF0066"></font></font>:</td>
            <td width="217"> <input type="text" name="requests" value="$requests" size="10"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Preferred contact method:</td>
            <td width="217"> <input type="radio" name="replymethod" value="email" checked> 
              <font size="-1">email </font> <input type="radio" name="replymethod" value="phone"> 
              <font size="-1">phone call 
              <input type="radio" name="replymethod" value="fax">
              fax</font></td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td nowrap height="28"><label for="replymethod"><font size="-1"></font></label></td>
            <td nowrap height="28"> <input type="submit" name="submit" value="submit"> 
              <input type="reset" name="clear" value="clear"> </td>
            <td width="116" height="28">&nbsp; </td>
          </tr>
        </table>
        <p>The homestead is a non-smoking area.</p>
        <p>A 50% deposit is required to confirm your reservation. If you cancel 
          and we are able to re-let the suite, we will refund your deposit, less 
          10% administrative fee. If we are unable to re-let, we will send you 
          a non-transferable voucher to the value of the deposit paid.</p>
      </form>
		";
		}
		else
		{
		// get day, date and time of form submission
$sub_time = date("D F d Y H:i:s.");
		// mail form data to info@ginninderry.com.au
mail("info@ginninderry.com.au", "Online enquiry", 
"Please contact the following potential client following an online enquiry\n
--------------------------------------------------------------\n
Name:				$name\n
Phone:				$phone\n
Mobile:				$mobile\n
Email:				$email\n
No of Rooms:		$NoRooms\n
No of guests:		$NoGuests\n
No of nights:		$NoNights\n
Arrival date:		$arrival\n
Add'l requests:		$requests\n
Preferred reply method:	$replymethod\n
---------------------------------------------------------------\n
User information\n
Client name and version: $HTTP_USER_AGENT\n
Clients IP address: $REMOTE_ADDR\n
Refering page: $HTTP_REFERER\n
---------------------------------------------------------------\n
Submission date and time: $sub_time\n
\n", "From: web@ginninderry.com.au\nReply-To: info@ginninderry.com.au\nX-Mailer: PHP/");
print "<h1>Thank you $name for your enquiry</h1>
		<p>Ginninderry Homestead will respond by $replymethod to your enquiry shortly.</p>";
		}
?>

this is the code of the original page

Code: Select all

<?php
	  	if (($name == "") or ($phone == "") or ($email == "") or ($town == "") or ($state == "") or ($country == ""))
		{
		print "<form name="contact" method="post" action="$PHP_SELF">
        <h1>Enquire or book online</h1>
		<p>You have not completed all required fields, please complete at least all fields marked with <font size="-1"><font color="#FF0066"><b>*</b></font></font>.</p>
        <table width="100%" border="0" cellspacing="1" cellpadding="1">
          <tr> 
            <td width="157">Name: </td>
            <td width="217"> <input type="text" name="name" value="$name" size="20"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td rowspan="2" width="116"><font size="-1"><font color="#FF0066"><b>*</b></font></font> 
              indicates a required field</td>
          </tr>
          <tr> 
            <td width="157">Phone:</td>
            <td width="217"> <input type="text" name="phone" value="$phone" size="20"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
          </tr>
          <tr> 
            <td width="157">Fax:</td>
            <td width="217"> <input type="text" name="fax" value="$fax" size="20"> </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Email:</td>
            <td width="217"> <input type="text" name="email" value="$email" size="20"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Street address:</td>
            <td width="217"> <input type="text" name="street" value="$street" size="20"> </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Town/Suburb/City:</td>
            <td width="217"> <input type="text" name="town" value="$town" size="20"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">State:</td>
            <td width="217"> <input type="text" name="state" value="$state" size="10"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Postcode:</td>
            <td width="217"> <input type="text" name="postcode" value="$postcode" size="6"> </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Country<font size="-1"><font color="#FF0066"></font></font>:</td>
            <td width="217"> <input type="text" name="country" value="$country" size="10"> <font size="-1"><font color="#FF0066"><b>*</b></font></font> 
            </td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td width="157">Preferred contact method:</td>
            <td width="217"> <input type="radio" name="replymethod" value="email" checked> 
              <font size="-1">email </font> <input type="radio" name="replymethod" value="phone"> 
              <font size="-1">phone call 
              <input type="radio" name="replymethod" value="fax">
              fax</font></td>
            <td width="116">&nbsp;</td>
          </tr>
          <tr> 
            <td nowrap height="28"><label for="replymethod"><font size="-1"></font></label></td>
            <td nowrap height="28"> <input type="submit" name="submit" value="submit"> 
              <input type="reset" name="clear" value="clear"> </td>
            <td width="116" height="28">&nbsp; </td>
          </tr>
        </table>
        <p>The homestead is a non-smoking area.</p>
        <p>A 50% deposit is required to confirm your reservation. If you cancel 
          and we are able to re-let the suite, we will refund your deposit, less 
          10% administrative fee. If we are unable to re-let, we will send you 
          a non-transferable voucher to the value of the deposit paid.</p>
      </form>
		";
		}
		else
		{
		// get day, date and time of form submission
$sub_time = date("D F d Y H:i:s.");
		// mail form data to info@ginninderry.com.au
mail("info@ginninderry.com.au", "Online enquiry", 
"Please contact the following potential client following an online enquiry\n
--------------------------------------------------------------\n
Name:				$name\n
Phone:				$phone\n
Fax:				$fax\n
Email address:		$email\n
Street address:		$steet\n
Town/Suburb:		$town\n
State:				$state\n
Postcode:			$postcode\n
Country:			$country\n
Preferred reply method:	$replymethod\n
---------------------------------------------------------------\n
User information\n
Client name and version: $HTTP_USER_AGENT\n
Clients IP address: $REMOTE_ADDR\n
Refering page: $HTTP_REFERER\n
---------------------------------------------------------------\n
Submission date and time: $sub_time\n
\n", "From: web@ginninderry.com.au\nReply-To: info@ginninderry.com.au\nX-Mailer: PHP/");
print "<h1>Thank you $name for your enquiry</h1>
		<p>Ginninderry Homestead will respond by $replymethod to your enquiry shortly.</p>";
		}
?>
hope you can help again i stress in lay terms as not a coder at all.
thanks in advance .
kevin


feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Post Reply