Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-18-2011, 09:59 PM   PM User | #1
georgesofroniou
New Coder

 
Join Date: Nov 2010
Location: Home: Essex, Current Location: Loughborough
Posts: 21
Thanks: 11
Thanked 0 Times in 0 Posts
georgesofroniou is an unknown quantity at this point
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
georgesofroniou is offline   Reply With Quote
Old 05-18-2011, 10:14 PM   PM User | #2
bullant
Banned

 
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
bullant is on a distinguished road
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.
bullant is offline   Reply With Quote
Old 05-18-2011, 10:21 PM   PM User | #3
georgesofroniou
New Coder

 
Join Date: Nov 2010
Location: Home: Essex, Current Location: Loughborough
Posts: 21
Thanks: 11
Thanked 0 Times in 0 Posts
georgesofroniou is an unknown quantity at this point
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 is offline   Reply With Quote
Old 05-19-2011, 10:04 AM   PM User | #4
georgesofroniou
New Coder

 
Join Date: Nov 2010
Location: Home: Essex, Current Location: Loughborough
Posts: 21
Thanks: 11
Thanked 0 Times in 0 Posts
georgesofroniou is an unknown quantity at this point
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>
georgesofroniou is offline   Reply With Quote
Reply

Bookmarks

Tags
form, hidden, html, input, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:23 PM.


Advertisement
Log in to turn off these ads.