Creating a Form Using HTML & PHP -


i trying create form on website (http://youngliferaffle.com/) using html, php, , bootstrap twitter. i've been looking through several tutorials on how create think i'm having trouble locations -- in relocating user if make error or after submit answers. i'm new php. appreciate help! thank you!

main issues:

  • "too many redirects webpage"/possibly due cookies
  • not receiving email submissions
  • user not being redirected correct page after submission or due bad submission

here part of html form:

<form method="post" action="contact-form-submission.php">   <fieldset>     <label><strong>sign-up</strong></label>      <input type="text" class="name" name="cname" id="name" placeholder="full name"></input>      <input type="text" class="phone" name="phone" id="phone" placeholder="phone number"></input>      <input type="text" class="email" name="email" id="email" placeholder="email address"></input>     <div class="form-actions">         <input type="submit" name="save" value="send">       </div>     </fieldset> </form> 

here php form

// check form submission - if doesn't exist send contact form   if (!isset($_post['save']) || $_post['save'] != 'contact') {    header('location: contact-form-submission.php');    exit;  }   // posted data  $name = $_post['contact_name'];  $email_address = $_post['contact_email'];  $phone = $_post['contact_phone'];   // check name entered  if (empty($name))    $error = 'you must enter name.';  // check email address entered  elseif (empty($email_address))     $error = 'you must enter email address.';  // check valid email address  elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', $email_address))    $error = 'you must enter valid email address.';  // check phone number entered  elseif (empty($phone))    $error = 'you must enter phone number.';   // check if error found - if there was, send user form  if (isset($error)) {    //am putting wrong location?   header('location: contact-form-submission.php?e='.urlencode($error)); exit;  }   // write email content  $email_content = "name: $name\n";  $email_content .= "email address: $email_address\n";  $email_content .= "phone:\n\n$phone";   // send email  mail ("myemail.com", "new contact message", $email_content);   // send user form //and i'm having trouble with! location part header('location: contact-form-submission.phps='.urlencode('thank message.'));  exit; 

the last line

header('location: contact-form-submission.phps='.urlencode('thank message.')); exit;  

seems have name right. why redirect php file itself. should use url of initial form, whatever name is. line creates redirect loop error get.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -