Jump to content

PHP FORM NEED HELP!!!!


redgtsviper

Recommended Posts

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

?>
Link to comment
Share on other sites

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. 
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 [code]$Name = $_POST['name'];[/code]
Try doing this for your code instead...
[code]
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
}
[/code]
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.