CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   Passing An Array to Another PHP File (http://www.codingforums.com/showthread.php?t=227238)

georgesofroniou 05-18-2011 09:59 PM

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 :cool:

bullant 05-18-2011 10:14 PM

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.

georgesofroniou 05-18-2011 10:21 PM

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?

georgesofroniou 05-19-2011 10:04 AM

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>



All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.