1

I have a form that I am validating via captcha. I have an if statement. If user enter wrong captcha, it tells it to go back. else the page should re-direct to the following

  http://tre.emv3.com/D2UTF8?emv_tag=876020001C384269&emv_ref=EdX7CqkdLe_d8SA9MOPQNCffL0p6Hq3D-jmueKEyWsbQKbo&FIRSTNAME_FIELD=XXXXXXXXX&LASTNAME_FIELD=XXXXXXXXX&DATEOFBIRTH_FIELD=XXXXXXXXX&EMAIL_FIELD=XXXXXXXXX&EMVCELLPHONE_FIELD=XXXXXXXXX&STORE_NAME_FIELD=XXXXXXXXX&

where every XXXXXXXX should be replaced by the variables from the form. when I try the code below, the variables do not get replaced. thank you for your help.

      <?php session_start(); ?>
      <?php 
      ob_start();
          date_default_timezone_set("Europe/London");
          include_once $_SERVER['DOCUMENT_ROOT'] . '/maininc/securimage/securimage.php';

          $securimage = new Securimage();
          if ($securimage->check($_POST['captcha_code']) == false) {
            // the code was incorrect
            // you should handle the error so that the form processor doesn't continue

            // or you can use the following code if there is no validation or you do not know how
            echo "THIS IS WRONG.<br /><br />";
            echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again.";
            exit;
          }else{
           $FIRSTNAME_FIELD = $_POST['FIRSTNAME_FIELD'];
           $LASTNAME_FIELD = $_POST['LASTNAME_FIELD'];
           $DATEOFBIRTH_FIELD = $_POST['DATEOFBIRTH_FIELD'];
           $EMAIL_FIELD = $_POST['EMAIL_FIELD'];
           $EMVCELLPHONE_FIELD = $_POST['EMVCELLPHONE_FIELD'];
           $STORE_NAME_FIELD = $_POST['STORE_NAME_FIELD'];
           header('location: http://tre.emv3.com/D2UTF8?emv_tag=876020001C384269&emv_ref=EdX7CqkdLe_d8SA9MOPQNCffL0p6Hq3D-jmueKEyWsbQKbo&FIRSTNAME_FIELD=echo$FIRSTNAME_FIELD;&LASTNAME_FIELD=echo$LASTNAME_FIELD;&DATEOFBIRTH_FIELD=echo$DATEOFBIRTH_FIELD;&EMAIL_FIELD=echo$EMAIL_FIELD;&EMVCELLPHONE_FIELD=echo$EMVCELLPHONE_FIELD;&STORE_NAME_FIELD=echo$STORE_NAME_FIELD;&');
          }
      ob_end_flush();
      exit;
      ?>

2 Answers 2

0

get rid of the echo's in your link and use header(" .. ") instead of '

read here why http://php.net/manual/en/language.operators.string.php

1
  • Thank you very much it solve my problems and gave ma a good night sleep. god bless you. Dec 4, 2012 at 17:41
0

Your string in the header function is surrounded by '. This will not convert variables. Change the surrounding ' with " and also remove the echo command.

       header("location: http://tre.emv3.com/D2UTF8?emv_tag=876020001C384269&emv_ref=EdX7CqkdLe_d8SA9MOPQNCffL0p6Hq3D-jmueKEyWsbQKbo&FIRSTNAME_FIELD=$FIRSTNAME_FIELD&LASTNAME_FIELD=$LASTNAME_FIELD&DATEOFBIRTH_FIELD=$DATEOFBIRTH_FIELD&EMAIL_FIELD=$EMAIL_FIELD&EMVCELLPHONE_FIELD=$EMVCELLPHONE_FIELD&STORE_NAME_FIELD=$STORE_NAME_FIELD");
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.