jacmaes
12/9/2013 - 1:59 PM

multi-step PW form. http://processwire.com/talk/topic/4775-online-course/?p=46789

if($input->post->step == 1) {

  // process step 1 form and display step 2 form
  $email = $sanitizer->email($input->post->email); 
  $session->email = $email; 

  echo "
    <form method='post' action='./'>
    <input type='text' name='fullname' placeholder='your full name'>
    <input type='hidden' name='step' value='2'>
    <input type='submit'>
    </form>
    ";
} else if($input->post->step == 2) {

  // process step 2 form, and email it
  $fullname = $sanitiizer->text($input->post->fullname); 
  $email = $session->email; 
  $body = "Full name: $fullname, Email: $email";
  mail('your@email.com', 'Form submission', $body, "From: $email"); 
  echo "<h2>Thanks, your message was sent!</h2>";

} else {

  // display step 1 form
  echo "
    <form method='post' action='./'>
    <input type='email' name='email' placeholder='your email'>
    <input type='hidden' name='step' value='1'>
    <input type='submit'>
    </form>
    ";
}