i'm having a problem with parsing variables from previous page and saving to database on the next page. i have two pages .
first page is where i view my data. i do a select sum, and it works.

now on my second page i want to take the total of the sum and save to database but

this is what i see when i echo my $sql query on my second page

"insert into admit (dated,valued) values (,) " which means my values are not taken in.

first page



          echo'<tbody> '; 

 $sql2="select sum(valued) as totalvalue from details where marker='' and dated='$dated'";
         $query = mysqli_query($conn,$sql2);
         $row2 = mysqli_fetch_array($query);

       echo '<tr>
            <td> TOTAL VALUE FOR &nbsp;'.$dated.'</TD>
            <td>' . $row2['totalvalue'] . '</td>

            echo'<tr><td><a href="confirm admission.php?date=' . $dated . '+'.$row2['totalvalue'].'">admit value</a></td></tr>'; 

        echo'</tbody> ';  


second page

confirm admission.php


     $valued = $_REQUEST['valued']; 

if (isset($_REQUEST['admit']))    

    $sql="insert into admit (dated,valued) values ($dated,$valued) ";

    echo $sql;


          <form name="form" method="GET" >

              are you sure you want to admit <?php echo $dated ?> <br /><br />

        <input type="submit" name="admit" value="yes">

        <a href="admission.php">no</img></a>



You can set your value you want in session and then just in secound page get that value from session.

on first page:
$_SESSION['value']= "Anything you want!";

on second page:
$variable = "";
if(isset($_SESSION['value'])) {
    $variable = $_SESSION["value"];

and if you work with sessions you need to put this on begining of php tag.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.