0

I have submitted the form with the passport_mrz1 and passport_mrz2 value, how to get passport_mrz1 value?

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
<!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></title>
    </head>
    <body>
        <h1>Passport Input</h1>
        <form action="" method="post" accept-charset="UTF-8">
            <label>passport_mrz1:
                <input name="passport_mrz1" type="text" value="P<USAWILLIAMS<<JUSTIN<<<<<<<<<<<<<<<<<<<<<<<" /></label>
            <br/>
            <label>passport_mrz2
                <input name="passport_mrz2" type="text" value="99003853<1USA1101018M1207046110101111<<<<<94"/></label>
            </br>
            <input type="submit" value="submit this form" />
        </form>

    </body>
</html>
  • 3
    Possible duplicate of [How to get input field value using PHP](https://stackoverflow.com/questions/13447554/how-to-get-input-field-value-using-php) – Brett Gregson Jan 24 '19 at 12:57
  • `$_POST['passport_mrz1']` ? I suggest you to follow tutorials about php form handling – Cid Jan 24 '19 at 12:57

1 Answers1

0

You can use POST method for passing data to PHP script. I adding button name clicked to do post conditions when clicked button.

?php 
if (isset($_POST['clicked'])) {

   echo $_POST['passport_mrz1'];
 }

 ?>

HTML is :

<!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></title>
</head>
<body>
    <h1>Passport Input</h1>
    <form action="" method="post" accept-charset="UTF-8">
        <label>passport_mrz1:
            <input name="passport_mrz1" type="text" value="P" ><USAWILLIAMS<<JUSTIN<<<<<<<<<<<<<<<<<<<<<<<" /></label>
        <br/>
        <label>passport_mrz2
            <input name="passport_mrz2" type="text" value="99003853<1USA1101018M1207046110101111<<<<<94"/></label>
        </br>
        <input type="submit" value="submit this form" name="clicked" />
    </form>

</body>

Omer Tekbiyik
  • 4,255
  • 1
  • 15
  • 27