Jump to content


Photo

PHP FORM NEED HELP!!!!


  • Please log in to reply
5 replies to this topic

#1 redgtsviper

redgtsviper
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 19 September 2006 - 10:04 PM

I am built this simple form on a website. Below I have posted both the form code and the php code on the processing page whats is going on with this. It is on a windows server that has PHP installed and configured



FORM


<form action="contact_ty.php" method="post" name="form1" onSubmit="VF_form1();return false;">
              <table width="97%" border="0" cellspacing="0" cellpadding="3" id="formStyled">
                <tr bgcolor="#E8FFFA">
                  <td width="27%" align="right" valign="top">&nbsp;</td>
                  <td width="73%" align="left" valign="top"></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top"><font size="2" face="Verdana">Name:</font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <input name="Name" type="text" id="Name" size="40">
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top"><font size="2" face="Verdana">Practice: </font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <input name="Practice" type="text" id="Practice" size="40">
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td height="32" align="right" valign="top"><font size="2" face="Verdana">Address:</font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <input name="Address" type="text" id="Address" size="40">
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top"><font size="2" face="Verdana">City:</font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <input name="City" type="text" id="City">
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top"><font size="2" face="Verdana">State: </font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <input name="State" type="text" id="State" size="3" maxlength="2">
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top"><font size="2" face="Verdana">Zip: </font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <input name="ZipCode" type="text" id="ZipCode">
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top"><font size="2" face="Verdana">Phone&nbsp;Number: </font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <input name="PhoneNumber" type="text" id="PhoneNumber">
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top"><font size="2" face="Verdana">Email
                      Address: </font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <input name="emailAddress" type="text" id="emailAddress" size="30">
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top"><font size="1" face="Verdana">Comments:</font></td>
                  <td align="left" valign="top"><font size="2" face="Verdana">
                    <textarea name="Comment" cols="37" rows="5" id="Comment"></textarea>
                  </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top">&nbsp;</td>
                  <td align="left" valign="top"><p><font size="2" face="Verdana"><br>
          Which type of In-Service do you prefer? </font></p>
                      <p><font size="2" face="Verdana">
                        <input name="InservicePreference" type="radio" value="Web Conference">
          Web conference <br>
          <input name="InservicePreference" type="radio" value="On-site In-Service">
          On-site In-Service</font></p>
                  </td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top">&nbsp;</td>
                  <td align="left" valign="top"><p><font size="2" face="Verdana">How
                        would you like to be contacted to schedule this In-Service?</font></p>
                      <p><font size="2" face="Verdana">
                        <input name="ContactPreference" type="radio" value="Phone">
          Phone<br>
          <input name="ContactPreference" type="radio" value="Email">
          Email<br>
                      </font></p>
                  </td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top">&nbsp;</td>
                  <td align="left" valign="top"><font size="2" face="Verdana">                       
                    <input type="submit" name="Submit" value="Submit">
                    </font></td>
                </tr>
                <tr bgcolor="#E8FFFA">
                  <td align="right" valign="top">&nbsp;</td>
                  <td align="left" valign="top">&nbsp;</td>
                </tr>
              </table>
              <p>&nbsp; </p>
            </form>




SCRIPT ON SECOND PAGE

<?php

$msg = "OrthoRx Contact Page Submission\n\n";

$msg .= "Name: $Name\n\n";

$msg .= "Practice: $Practice\n\n";

$msg .= "Address: $Address\n\n";

$msg .= "City: $City, State: $State  ZipCode: $ZipCode\n\n";

$msg .= "Phone Number: $PhoneNumber\n\n";
 
$msg .= "Email Address: $emailAddress\n\n";
 
$msg .= "Comments: $Comment\n\n";
 
$msg .= "In-Service: $InservicePreference\n\n";

$msg .= "Contact Preference: $ContactPreference\n\n";



// Edit if it is nessecery
$to = "$myemail@mydomain.com";
$subject = "CONTACT PAGE FROM OrthoRx WEBSITE";
$mailheaders = "From: OrthoRx Contact Page Submission Form <$emailAddress>\n";
$mailheaders .= "Reply-To:$Email_Address <$emailAddress>\n\n";
// Mail to address
mail ( $to, $subject, $msg, $mailheaders );

?>

#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 19 September 2006 - 10:07 PM

What's it doing, is it returning an error, is it not working, how is it not working, what's it doing.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 19 September 2006 - 10:08 PM

Also your form is severely bloated, you could probably cut that down to about 10-12 lines for the form, and use css to style it, instead of about 30-40 lines of wasted space.  Also whether you are a php programmer, it only takes about 2 days to learn how to program form validation and email sending.  Using a third party script is normally not as secure. 

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#4 redgtsviper

redgtsviper
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 19 September 2006 - 10:14 PM

Here is the error




Notice: Undefined variable: Name in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 94

Notice: Undefined variable: Practice in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 96

Notice: Undefined variable: Address in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 98

Notice: Undefined variable: City in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 100

Notice: Undefined variable: State in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 100

Notice: Undefined variable: ZipCode in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 100

Notice: Undefined variable: PhoneNumber in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 102

Notice: Undefined variable: emailAddress in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 104

Notice: Undefined variable: Comment in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 106

Notice: Undefined variable: InservicePreference in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 108

Notice: Undefined variable: ContactPreference in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 110

Notice: Undefined variable: toaddress in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 115

Notice: Undefined variable: emailAddress in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 117

Notice: Undefined variable: Email_Address in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 118

Notice: Undefined variable: emailAddress in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 118

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Inetpub\wwwroot\pixelart\Ortho RX\contact_ty.php on line 120

#5 redgtsviper

redgtsviper
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 19 September 2006 - 10:44 PM

Here is the PHP info for the server

http://www.orthorx.net/php.php

#6 pgsjoe

pgsjoe
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 19 September 2006 - 10:48 PM

as for the mail error, that's on your server end and looks like it's not going to send even if you do get it. the problem seems to be that you're not pulling the variables from your form. The value of the "Name" textfield isn't $Name, it's
$Name = $_POST['name'];
Try doing this for your code instead...
 if (isset($_POST['name'])) {
$Name = $_POST['Name'];
$Practice = $_POST['Practice'];
//etc.

//then your code for the msg part of it...
 $msg = "OrthoRx Contact Page Submission\n\n";

 $msg .= "Name: $Name\n\n";
//etc.

//finally, the mail info
 $to = "$myemail@mydomain.com";
 $subject = "CONTACT PAGE FROM OrthoRx WEBSITE";
 $mailheaders = "From: OrthoRx Contact Page Submission Form <$emailAddress>\n";
 $mailheaders .= "Reply-To:$Email_Address <$emailAddress>\n\n";
 // Mail to address
 mail ( $to, $subject, $msg, $mailheaders );

//and don't forget to close out the if statement
}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users