0

I Just want to send passport number in the url on the next page. I know it will go into the url like this continue-to-pay.php?pno=$passportnumber". But how will I post passport number on the next page.

    <?php 

    include'connection.php';

    $pno=$_GET['pno'];


    $sql="SELECT * FROM user WHERE passportnumber='$pno'";

    $query = mysqli_query($conn, $sql);
            while($row = mysqli_fetch_assoc($query))
            {
    ?>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-5 text-right" id="review">
<ul>

<li class="list">Passport Number </li>

</ul>
</div>

<div id="review2">
<ul> 
<li class="list"><?php echo $row['passportnumber']; ?></li>

</ul>
</div>  





<br><br>
<div class="col-xs-6 col-sm-12 col-md-12 col-lg-12" align="center" 
valign="top">
<a href="e-visa-application.php?actionType=edit" class="btn btn-primary 
btn-lg mgn-btm mgn-top ">Edit</a>           
<a href="process.php" class="btn btn-primary btn-lg mgn-btm mgn-top 
">Continue to pay</a>   
</div>
Rimsha Miraj
  • 25
  • 1
  • 8
  • 4
    Your code is vulnerable to [**SQL injection**](https://en.wikipedia.org/wiki/SQL_injection) attacks. You should use prepared statements with bound parameters, via either the [**mysqli**](https://secure.php.net/manual/en/mysqli.prepare.php) or [**PDO**](https://secure.php.net/manual/en/pdo.prepared-statements.php) drivers. [**This post**](https://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) has some good examples. – Alex Howansky Sep 06 '17 at 13:52
  • 1
    Please be carefull for SQL injection – Jesse de gans Sep 06 '17 at 13:52
  • You need to learn the basics, you have `$_POST` ***and*** `$_GET` at your disposal and the ability to put them in the `href` property of an `a` tag. – Script47 Sep 06 '17 at 13:52
  • 1
    Heed the above warnings especially if you have sensitive data going through your system. – Script47 Sep 06 '17 at 13:53
  • 1
    @RimshaMiraj I'm afraid you should read the other comments and follow their advice : learn your basics. You can make it work easily, that's left as an exercise to you. – Calimero Sep 06 '17 at 13:59

3 Answers3

0

if you got the PNO at your URL you can get it in a PHP file using $_GET :

<?php
    if (isset($_GET['pno'])) {
        echo $_GET['pno'];
    }else{
        // Fallback behaviour goes here
    }
?>
AIT MANSOUR Mohamed
  • 809
  • 1
  • 7
  • 20
0

You are probably searching for "The PHP session system" to keep the pno in the session while the user is going through the steps.

The PHP session system lets you store securely data in the $_SESSION global array. A example is to store the pno in the session.

 session_start();
  $_SESSION['pno'] = $pno;

Then, you can access that information on all other pages:

if (isset($_SESSION['pno']))
  echo $_SESSION['pno'];

More info about sessions here

Jesse de gans
  • 1,432
  • 1
  • 14
  • 27
0

You can use $_REQUEST:

<?php
$_REQUEST['pno'] = $pno;

?>

you can use it to retrieve the pno in the continue-to-pay.php?pno=$passportnumber

User
  • 1
  • 2