Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2010
    Location
    Home: Essex, Current Location: Loughborough
    Posts
    21
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Question Passing An Array to Another PHP File

    Hi

    I am currently studying a server side programming module at uni and we have been set a piece of coursework to create a holiday planner website.

    So far I have created a 'flights' & 'hotels' selection page and to finish off the work I need to create an itinerary where it can show customers their selected flights/hotel for their holiday.

    Throughout the work so far I have created separate pages through <forms> and iframes I have linked them to the 'main' start page.

    Now I am having issues with the itinerary, I have a basic logic of what I may have to do to get a working itinerary (essentially, taking the users' inputs to the itinerary page), using an array to be sent to the itinerary form through hidden inputs, however I am really struggling to put this into practice and wondered if any guidance could be offered?

    Cheers

  • #2
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Without seeing your code it's a bit difficult visualising exactly what you are doing and how.

    But what about maybe storing the user inputs in session variables and then you will have access to them on any page where you continue the session.

  • #3
    New Coder
    Join Date
    Nov 2010
    Location
    Home: Essex, Current Location: Loughborough
    Posts
    21
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Hi Bullant

    yes sorry I forgot to add about the code haha, I am not sure what bits of the code you'd require me to post so I thought it would be best not to just chuck a load of code onto a page and confuse everyone.

    I have researched and seen session variables crop up a few times, I am a bit of a newbie if I am honest and its confusing me slightly.

    What bits of the code would you find most useful to aid the visuals?

  • #4
    New Coder
    Join Date
    Nov 2010
    Location
    Home: Essex, Current Location: Loughborough
    Posts
    21
    Thanks
    11
    Thanked 0 Times in 0 Posts
    PHP Code:
    <b><a class="aPara">Outbound:</a></b>
            <div class="divOutbound">
                <table width="100%" class="resultsTable" align="center"> 
                    <tr>
                        <th><u>Airline</u></th>
                        <th><u>Departure Airport</u></th>
                        <th><u>Departure Date</u></th>
                        <th><u>Departure Time</u></th>
                        <th><u>Arrival Airport</u></th>
                        <th><u>Arrival Date</u></th>
                        <th><u>Arrival Time</u></th>
                        <th><u>Fare</u></th>
                        <th><u>Choice</u></th>
                    </tr>
                    <tr>
        
                    <?php
                    
    #if connection does not work use PEAR         
                    
    include("database.php");
                    
                    
    $flight_tab="flight";
                    
    $hotel_tab="hotel";
                    
                    
    $outDate=$_REQUEST["flightDateDep"];
                    
    $inDate=$_REQUEST["flightDateRet"];
                    
    $depAir=$_REQUEST["airportDeparture"];
                    
    $arrAir=$_REQUEST["airportArrival"];
                    
                    
    $selSQL="SELECT * FROM flight WHERE DepartureAirport='$depAir' AND DestinationAirport='$arrAir' AND DepartureDate='$outDate'";
                    
    $resSQL=mysql_query($selSQL$myconn2) or die(mysql_errno().':'.mysql_error());;


                    while(
    $row=mysql_fetch_array($resSQL)){
                    echo 
    '<tr>
                        <td class="cell" align="center" height="19"><input type="hidden" name="OAir" value=""/>'
    .$row["Airline"].'</td>
                        <td class="cell" align="center" height="19"><input type="hidden" name="ODepAir" value=""/>'
    .$row["DepartureAirport"].'</td>
                         <td class="cell" align="center" height="19"><input type="hidden" name="ODepDate" value=""/>'
    .$row["DepartureDate"].'</td>
                        <td class="cell" align="center" height="19"><input type="hidden" name="ODepTime" value=""/>'
    .$row["DepartureTime"].'</td>
                        <td class="cell" align="center" height="19"><input type="hidden" name="OArrAir" value=""/>'
    .$row["DestinationAirport"].'</td>
                        <td class="cell" align="center" height="19"><input type="hidden" name="OArrDate" value=""/>'
    .$row["ArrivalDate"].'</td>
                        <td class="cell" align="center" height="19"><input type="hidden" name="OArrTime" value=""/>'
    .$row["ArrivalTime"].'</td>
                        <td class="cell" align="center" height="19"><input type="hidden" name="OFare" value=""/>£ '
    .$row["Fare"].'</td>
                        <td class="cell" align="center" height="19"><input type="checkbox" name="cboxFlight" id="cboxFlight"/></td>
                        </tr>'
    ;           
                
                    }

                    
    ?> 

                    <td colspan="9" align="center">
                        <p class="errorText">Please Select Your Outbound Flights</p>
                    </td>
                    </tr>
                </table>
            </div>


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •