0

I have a two pages index.php and seat.php When the user select arrival,destination and date from index.php page then he retrieve the value from database. The user choose value of database and then move to the next page. But I faced a problem when a user move to the seat.php page he can't get the date selected in index.php page (not show in text box).

The error message is

Notice: Undefined index: doj in C:\wamp\www\ Ticket Reservation System\seat.php Call Stack)

here this is the code for index page:

<?php
    include("dbconnect.php");
    session_start();
    $_SESSION['date'] = 'doj';
?>

<form method="POST">
  <td width="48" height="32" class="simpletext">FROM:</td>
  <td width="107">
    <div align="justify">
      <select class="html-text-box" ; font-style:oblique; width:100px; font-family:verdana; font-weight:bold" name="from">
    <option value=" " selected>:: Departure ::</option>
    <option value="ABBOTTABAD ">ABBOTTABAD</option>
    <option value="BAHAWALPUR " >BAHAWALPUR</option>
    <option value="CHINIOT " >CHINIOT</option>
    <td width="24 " align="right "  class="simpletext "><div align="center ">TO:    </div></td>
    </select>
    <td width="107 "  align="left "><select class="html-text-box "     font-  style:oblique; width:100px; font-family:verdana; font-weight:bold" name="to">
        <option value="" selected>:: Arrival ::</option>
        <option value="ABBOTTABAD">ABBOTTABAD</option>
        <option value="BAHAWALPUR">BAHAWALPUR</option>
      </select>
      <tr>
        <td height="32" class="simpletext">DEPERATURE</td>
        <td>
          <div data-date-format="yyyy-mm-dd" data- date="document.write(date())" class="input-append date myDatepicker">
            <input type="text" value="" name="doj" size="16" class="span2" required><span class="add-on"><i class="icon-calendar">  </i></span> 
          </div>
        </td>
    </div>
    <td align="right" class="simpletext">RETURN:</td>
    <td>
      <div data-date-format="yyyy-mm-dd" data-date="document.write(date())" class="input-append date myDatepicker">
        <input type="text" value="" name="doj" size="12" class="span2" required>
        <span class="add-on"><i class="icon-calendar"></i></span> 
      </div>
    </td>
    </tr>
    <tr>
      <td height="34" colspan="4" align="center" valign="middle">
        <p>
          <input type="submit" name="search" value="Search" onClick="return callfrm(document.getElementById('currentdate').value);" class="html-button">
          <input type="submit" name="resert" value="Reset" class="html- button">
        </p>
        <p>&nbsp;</p>
      </td>
    </tr>
</form>

this is the code that i use for seat page

<?php
    session_start();
    $date = $_SESSION['doj'];   
?>
<?php
    $date = strip_tags( utf8_decode( $_POST['doj'] ) );
    $query = "select * from seat where date = '" . $date . "'";
    $result = mysql_query($query);
    {
    }           

    <label>Date of Journey</label>
<?php
    echo "<input type='text' class='span2'     name='doj' value='". $date ."' readonly/>";
?>
empiric
  • 7,825
  • 7
  • 37
  • 48
sara
  • 11
  • 6
  • i can't get the value of doj on seat page......... – sara Jun 11 '15 at 20:24
  • Please review your markup carefully there are a lot of snytax errors. – empiric Jun 12 '15 at 08:54
  • yeh i know actually i take a chunck of code from my two pages as it is imposible to display my all code because it is too lengthy(if it is possible then i email u my hole code?????)......so my question is about (doj) variable the value is not get on seat.php page – sara Jun 12 '15 at 09:03
  • Note: `$_SESSION['date']` != `$_SESSION['doj']` – empiric Jun 12 '15 at 09:28

0 Answers0