简体   繁体   中英

how to redirect to previous page after click on a continue as a guest button php

i'm booking an appointment in one page if i already logged in it will book..other wise page will redirect to login page,in login page one one option like continue as a guest ,if i click on continue as a button page should redirect same operation(Appointment booking with particular id-previous url of search results) is suppose to come.how to redirect a page with previous results using php

Following is my code:

appointment.php:
<?php session_start();
ini_set("display_errors",1);
include("config.php");
    $Doctor = $_GET['strdoc1']; 
    $my_data=mysql_real_escape_string($Doctor);
     $sql="SELECT E.EMPLOYEE_ID,E.FIRST_NAME,E.LAST_NAME,E.EMPLOYEE_EMAIL,E.PHONE_NUMBER,E.MOBILE_NUMBER, E.USER_IMAGE,

     E.EMPLOYEE_EDUCATION,E.EMPLOYEE_SPECIALIZATION,E.EMPLOYEE_EXPERIENCE,

     EA.APARTMENT,EA.DOOR_NO,EA.STREET,EA.AREA,EA.LANDMARK,

      EU.EMP_UNIT_ID,EU.EMPLOYEE_IN_TIME,EU.EMPLOYEE_OUT_TIME,

     U.UNIT_ID,U.UNIT_TITLE,U.UNIT_ADDRESS1,U.UNIT_ADDRESS2,U.UNIT_STREET,U.UNIT_AREA,CO.COUNTRY_TITLE,S.STATES_TITLE,C.CITY_TITLE,

     U.UNIT_LANDMARK,U.UNIT_POSTAL_CODE,U.UNIT_PHONE_NUMBER1,U.UNIT_PHONE_NUMBER2,U.UNIT_FAX_NUMBER,U.UNIT_CONTACT_EAMIL 

     FROM EMPLOYEE_UNIT EU 

     INNER JOIN EMPLOYEE E on E.EMPLOYEE_ID=EU.EMPLOYEE_ID
     INNER JOIN UNIT U on U.UNIT_ID=EU.UNIT_ID

     INNER JOIN EMPLOYEE_ADDRESS EA ON E.EMPLOYEE_ID = EA.EMPLOYEE_ID 


     INNER JOIN COUNTRY CO ON U.COUNTRY_ID=CO.COUNTRY_ID

     INNER JOIN STATES S ON U.STATES_ID = S.STATES_ID

     INNER JOIN CITY C ON U.CITY_ID=C.CITY_ID

     WHERE EU.EMP_UNIT_ID = '$my_data'";



    $result = mysql_query($sql) or die(mysql_error());

    $row=mysql_fetch_array($result);

    $query="SELECT DISTINCT UNIT_AREA FROM UNIT";
    $result1=mysql_query($query); 


$patient="SELECT * FROM PATIENT WHERE PATIENT_ID='".$_SESSION['PATIENT_ID']."'";
$r=mysql_query($patient);
$ps=mysql_fetch_array($r);



?>
 <?php if($_SESSION['PATIENT_ID']) { ?>

            <a href="appointment" class="appointment" title="Book Appointment">Book Appointment</a>

            <?php } else { ?>

            <a href="login" class="appointment" title="Book Appointment">Book Appointment</a>
            <?php } ?>


login .php:

 <a href="signin.php">New Patient Registration</a><a href="">Continue As a Guest</a>
        </div>

The easiest way is to store your result in session. The you can access it in all pages.

You can also store it in a variable and make it be a url parameter.
Then when you redirect to other page, just add the parameter behind your url.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM