Page 1 of 1

Newbie

Posted: Wed Jul 22, 2009 5:55 pm
by tbeasley15
Hi, I am new to PHP and used a form generator to create my form. Problem was it didn't have all of the fields I needed so I added them myself in the html code. However: when the form is submitted the new field's info doesn't get submitted. How can I solve this? Also, how can I email to multiple addresses? Thanks?

HTML CODE:

Code: Select all

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Durham and Crane Law</title>
<meta http-equiv="Content-Language" content="en" />
<meta name="description" content=""Durham & Crane, a seasoned trial lawyer firm in Augusta, Georgia with over 22 years experience in obtaining multi-million dollar settlements and jury verdicts for serious injury  and death claims" />
<meta name="keywords" content="Durham, Crane, Law, Lawyers, Augusta, Georgia, Assaults, Automobile Accident, Burglary, Criminal Defense, Defective Product, Drug Crimes, DUI, Homicides, Hospital Negligence, Juvenile Litigation, Major Felonies, Medical Malpractice, Misdemeanors, Nursing Home Abuse and Neglect, Parole, Personal Injury, Probation, Slip and Fall, Theft, Tractor Trailer Injuries, Trial Practice, Wrongful Death">
 
<style type="text/css">
<!--
body {
    background-image: url();
}
-->
</style>
<STYLE>
<!--
A{text-decoration:none}
.style20 {font-family: Arial, Helvetica, sans-serif}
.style21 {color: #993300}
.style22 {color: #333333}
.style27 {font-size: 10px}
-->
</STYLE>
 
</head>
<body onload=";MM_CheckFlashVersion('8,0,0,0','Content on this page requires a newer version of Adobe Flash Player. Do you want to download it now?')">
<table height="36" border="0" align="center" cellpadding="2" cellspacing="0">
  <tr>
    <td width="700" align="left" valign="top"><table width="701" height="40" border="0" cellpadding="0" cellspacing="0" id="Table_01">
      <tr>
        <td width="85"><div align="left"><a href="index.shtml"><img src="images/menu-blue.gif" alt="home-blue" width="84" height="40" border="0" /></a></div>
            <div align="left"></div>
          <div align="left"></div>
          <div align="left"></div></td>
        <td width="128"><a href="aboutus.html"><img src="images/menu_02.gif" alt="About Us" width="128" height="40" border="0" /></a></td>
        <td width="155"><a href="testimonials.html"><img src="images/menu_03.gif" alt="Testimonials" width="154" height="40" border="0" /></a></td>
        <td width="172"><a href="areas.html"><img src="images/menu_04.gif" alt="Areas of Practice" width="200" height="40" border="0" /></a></td>
        <td width="161"><a href="contact.html"><img src="images/menu_05.gif" alt="Contact Us" width="134" height="40" border="0" /></a></td>
      </tr>
    </table></td>
  </tr>
</table>
<tr><td align="center" valign="top"><p align="center" class="style35"><span class="style75"><span class="style86"><span class="style93 style20 style22">Contact Us.</span></span></span><br />
      <br />
      <span class="style95"><span class="style52 style96 style20 style21"><strong><strong>SUBMIT YOUR INQUIRY BELOW</strong></strong></span></span> </p>
    <form action="feedback.php" method="post">
<table border="0" align="center" cellpadding="8" cellspacing="8" summary="feedback form">
<tr>
<td width="92"><label for="tswname">Name</label>:</td><td width="362"><input type="text" name="fullname" id="tswname" size="45" /></td>
</tr>
<tr><td><label for="tswemail">Email address</label>:</td><td><input type="text" id="tswemail" name="email" size="45" /></td>
</tr>
<tr><td><label for="tswstreet">Street address</label>:</td><td><input type="text" id="tswstreet" name="street" size="45" /></td>
</tr>
<tr>
<td><label for="tswcitystate">City/State</label>:</td><td><input type="text" id="tswcitystate" name="citystate" size="45" /></td>
</tr>
<tr>
<td><label for="tswzip">Zip Code</label>:</td><td><input type="text" id="tswzip" name="zip" size="45" /></td>
</tr>
<tr>
<td><label for="tswphone">Phone</label>:</td><td><input type="text" id="tswphone" name="phone" size="45" /></td>
</tr>
<tr>
<tr>
<td colspan="2">
<label for="tswcomments">What can we help you with?</label><br />
<textarea rows="15" cols="59
" name="comments" id="tswcomments"></textarea></td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Send Inquiry" /><br />
<span class="style27">Powered by <a href="http://www.thesitewizard.com/">thesitewizard.com</a></span></td>
</tr>
</table>
</form>
</body>
</html>
 
PHP CODE:

Code: Select all

 
 
<?php
 
$mailto = "hankcrane@comcast.net" ;
 
$subject = "Inquiry Submission" ;
 
$formurl = "http://www.durhamandcranelaw.com/feedback.html" ;
$errorurl = "http://www.durhamandcranelaw.com/error.html" ;
$thankyouurl = "http://www.durhamandcranelaw.com/thankyou.html" ;
 
$email_is_required = 1;
$name_is_required = 1;
$comments_is_required = 1;
$uself = 0;
$use_envsender = 0;
$use_sendmailfrom = 0;
$use_webmaster_email_for_from = 0;
$use_utf8 = 1;
$my_recaptcha_private_key = '' ;
 
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;
if (!isset( $use_envsender )) { $use_envsender = 0 ; }
if (isset( $use_sendmailfrom ) && $use_sendmailfrom) {
    ini_set( 'sendmail_from', $mailto );
}
$envsender = "-f$mailto" ;
$fullname = (isset($_POST['fullname']))? $_POST['fullname'] : $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
 
if (!isset($_POST['email'])) {
    header( "Location: $formurl" );
    exit ;
}
if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) {
    header( "Location: $errorurl" );
    exit ;
}
if ( preg_match( "/[\r\n]/", $fullname ) || preg_match( "/[\r\n]/", $email ) ) {
    header( "Location: $errorurl" );
    exit ;
}
if (strlen( $my_recaptcha_private_key )) {
    require_once( 'recaptchalib.php' );
    $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
    if (!$resp->is_valid) {
        header( "Location: $errorurl" );
        exit ;
    }
}
if (empty($email)) {
    $email = $mailto ;
}
$fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ;
 
if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
}
 
$messageproper =
    "This message was sent from:\n" .
    "$http_referrer\n" .
    "------------------------------------------------------------\n" .
    "Name of sender: $fullname\n" .
    "Email of sender: $email\n" .
    "------------------------- COMMENTS -------------------------\n\n" .
    $comments .
    "\n\n------------------------------------------------------------\n" ;
 
$headers =
    "From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" .
    $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;
 
if ($use_envsender) {
    mail($mailto, $subject, $messageproper, $headers, $envsender );
}
else {
    mail($mailto, $subject, $messageproper, $headers );
}
header( "Location: $thankyouurl" );
exit ;
 
?>

Re: Newbie

Posted: Sat Aug 01, 2009 12:42 am
by Twainy
HOLY SMOKES I used that same wizard and I am struggling with it ... PHP .. new to me ...

I need help ... I have looked looked looked and relooked ... I uploaded the Feedback Form and Thank You HTML files and the PHP file ... then went and tried it ... I put the proper info in the form (cuz I haven't created the Error html file yet) .... looks fabulous I might add ... and I press SUBMIT ... waitttt for it ... POOF ... there is my Thank You Page ... AWESOME ... but no e-mail ... I looked ....I have the correct e-mail address in the PHP form ... is there something ele that might cause the e-mail not to be sent to me?

Did you get any real help yet?

Thanx
Happpy Weekend
:banghead: