Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   Web design and Programming (https://novahq.net/forum/forumdisplay.php?f=32)
-   -   php HELP!!! (https://novahq.net/forum/showthread.php?t=45702)

the þrox™ 01-18-2011 05:51 PM

php HELP!!!
 
Whats wrong with my coding?

I keep getting this error:

Parse error: syntax error, unexpected $end....

PHP Code:

<?php 
 $to 
$_REQUEST['sendto'] ; 
 
$from $_REQUEST['Name'] ; 
 
$name $_REQUEST['Name'] ;
 
$address $_REQUEST['Address'] ;
 
$city $_REQUEST['City'] ;
 
$state $_REQUEST['State'] ;
 
$zip $_REQUEST['Zip'] ;
 
$phonenumber $_REQUEST['PhoneNumber'] ;
 
$headers "From: $from"
 
$subject "Home Delivery Service Request"
 
 
$fields = array(); 
 
$fields{"Name"} = "Name"
 
$fields{"Address"} = "Address"
 
$fields{"City"} = "City"
 
$fields{"State"} = "State"
 
$fields{"Zip"} = "Zip"
 
$fields{"PhoneNumber"} = "PhoneNumber"
 
 
$body "We have received the following information:\n\n"; foreach($fields as $a => $b){     $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } 
 
 
$headers2 "From: comments@cometsatx.com"
 
$subject2 "Thank you for contacting us"
 
$autoreply "Thank you for contacting us. We will review your request for your area and will contact you as soon as it becomes avaliable!";
 
 if(
$from == '') {print "You have not entered a name, please go back and try again";} 
 else { 
 if(
$name == '') {print "You have not entered a name, please go back and try again";} 
 else {
 if(
$address == '') {print "You have not entered an address, please go back and try again";} 
 else {
 if(
$city == '') {print "You have not entered a city, please go back and try again";} 
 else {
 if(
$state == '') {print "You have not entered a state, please go back and try again";} 
 else {
 if(
$zip == '') {print "You have not entered a zip code, please go back and try again";} 
 else {
 if(
$phonenumber == '') {print "You have not entered a phone number, please go back and try again";} 
 else {
 
$send mail($to$subject$body$headers); 
 
$send2 mail($from$subject2$autoreply$headers2); 
 if(
$send
 {
header"Location: thankyou.htm" );} 
 else 
 {print 
"We encountered an error sending your mail, please notify webmaster@cometsatx.com"; } 
 
?>

Html portion of the form code:
HTML Code:

<form method="post" action="hd.php">
                      <table bgcolor=#fff0c3 align=left>
                        <tr>
                          <td colspan=2><strong class="style6"><i>Request Service in Your Area:</i></strong></td></tr>
                        <tr><td class="style6">Department:</td><td><select name="sendto"> <option value="comments@cometsatx.com">HD Service</option></select></td></tr>
                        <tr><td class="style6"><font color=red>*</font> Name:</td><td><input size=25 name="Name"></td></tr>
                        <tr><td class="style6"><font color=red>*</font> Address:</td><td><input size=25 name="Address"></td></tr>
                        <tr><td class="style6"><font color=red>*</font> City:</td><td><input size=25 name="City"></td></tr>
                        <tr><td class="style6"><font color=red>*</font> State:</td><td><input size=1 name="State"></td></tr>
                        <tr><td class="style6"><font color=red>*</font> Zip:</td><td><input size=4 name="Zip"></td></tr> 
                        <tr><td class="style6"><font color=red>*</font> Phone Number:</td><td><input size=25 name="PhoneNumber"></td></tr>
                        <tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr>
                        <tr><td colspan=2 align=center><small class="style6">A <font color=red>*</font> indicates a field is required</small></td></tr>
                </table>
                    </form>
          <br>
                    <p align="right"><img src="images/hdplaceholder.png" width="278" height="202"></p>
                    <p align="justify">&nbsp;</p>
                   
          <p align="justify">&nbsp;</p>
      <br>
      <br>
      <span class="style5"><br>
          </span>
      <p align="justify" class="style5"><em>Any further questions can be answered by calling: (210) 332-3302 and ask our Home Delivery Service.</em></p>
          <p align="justify">&nbsp;</p></td>



<td background="images/index_08.png" width="7" height="46" alt=""></td>

                <td background="images/index_09.png" width="242" height="46" alt="" valign="top">


Website to view form:

http://kkdigitaldesigns.com/cometcle...medelivery.htm

the þrox™ 01-18-2011 08:06 PM

Please disregard! Steve helped me :]

atholon 01-19-2011 03:16 PM

Steve FTW!

the þrox™ 01-23-2011 06:49 PM

Ok, i've run into a problem, im trying to make the php send an alert box popup when someone fails to enter the required information. Right now it sends you to a new page saying "You have not entered an address, please go back and try againYou have not entered a city, please go back and try again".

Instead of this i want it to pop up with an alert box, or something simular saying they need to enter the required field. Any help?

Lakie 01-23-2011 09:43 PM

http://www.weberdev.com/get_example-4111.html

Something like that?

atholon 01-24-2011 11:01 AM

If you want an alert box you'd have to do the validation with javascript and/or ajax.


All times are GMT -5. The time now is 09:13 AM.

Powered by vBulletin®