Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple submit buttons from xml

Status
Not open for further replies.

samfitz

Programmer
Jan 16, 2009
8
0
0
US
howdy gang,
i'm a total noob coming to the forum a little exasperated. i've taken on a half baked project and am 99.9% done! the final step is correcting a multiple submit button error. i believe it's a php problem, but am posting this in the javascript forum as well to make sure.

background:
this is a hotel booking system pulling from the ihs xml database. if you would like to see the site in action go to:
(i've included a sample hotel, but feel free to search others if you prefer)

if you run a booking (choose dates, click 'get rates' and then 'book it' on the following page you will see where the error is occurring. it seems that the 'book it' submit button always passes the last rate listed on the page.

you may also notice that there is a js alert when 'book it' is clicked. this is the only proof i have for myself that the correct info is being posted, but as you can see, it isn't.

i've been so buried in this and i think i've just lost the ability to think about it clearly. any help would be much appreciated. rather than dumping tons of code on here, have a look at the live stuff and please tell me what you would like to see. i'll post it.

Thanks in advance!
sam
 
changed my mind! here is a chunk from the hotel_availability.php page:

Code:
<? session_start();
//**STEP 1 & 2 INCLUDES MUST BE THE TOP MOST LINES ON THE PAGE**
//**STEP 1 (FUNCTIONS) MUST BE INCLUDED BEFORE STEP 2 (LIBRARY)**
// STEP 1: INLCUDE SERVER AJAX FUNCTIONS 
   include ("../ajaxserverfx.php"); 
// STEP 2: INCLUDE AJAX AGENT LIBRARY 
   include_once("../ajaxagent.php");
// IHS Integration
	include_once "../ihsHttpRequest.php";
		$baseurl = "[URL unfurl="true"]http://xml.ihsadvantage.com/xmlhotel.jsp?xml=";[/URL]
		$f = 1;
		$c = 2;//1 for header, 2 for body, 3 for both
		$r = NULL;
		$a = NULL;
		$cf = NULL;
		$pd = NULL;
	
		// 	Posting Variables already acquired from previous requests.
		$hotelID = $_POST['hotelID'];
		$numOfRooms = $_POST['numOfRooms'];
		$selectedRoom = $_POST['selectedRoom'];
		$numberOfAdults = $_POST['numberOfAdults'];
		$numberOfChildren = $_POST['numberOfChildren'];
		$inDate = $_POST['inDate'];
		$outDate = $_POST['outDate'];
		$supplierID = $_POST['supplierID'];
	
		// Availability Request
		$availQueryStr = "<HotelSessionRequest%20method='runHotelAvailRequest'>";
		$availQueryStr = $availQueryStr . "<HotelAvailRequest>";
		$availQueryStr = $availQueryStr . "<hotelID>" .$hotelID. "</hotelID>";
		$availQueryStr = $availQueryStr . "<inDate>" .$inDate. "</inDate>";
		$availQueryStr = $availQueryStr . "<outDate>" .$outDate. "</outDate>";
		$availQueryStr = $availQueryStr . "<numberOfAdults>" .$numberOfAdults. "</numberOfAdults>";
		$availQueryStr = $availQueryStr . "<affiliateID>5469</affiliateID>";
		$availQueryStr = $availQueryStr . "<numOfRooms>" .$numOfRooms. "</numOfRooms>";
		$availQueryStr = $availQueryStr . "<numberOfChildren>" .$numberOfChildren. "</numberOfChildren>";
		$availQueryStr = $availQueryStr . "<supplierID>0</supplierID>"; // supplierID = 0 for searching
		$availQueryStr = $availQueryStr . "</HotelAvailRequest>";
		$availQueryStr = $availQueryStr . "</HotelSessionRequest>";
		// echo $availQueryStr;	
		$url = $baseurl . $availQueryStr;
		// echo $url;	
		$availXML = open_page($url,$f,$c,$r,$a,$cf,$pd);
		$availXML = str_replace('US-ASCII','utf-8',$availXML);
		// echo $availXML;
		$dom = new DOMDocument();
		$dom->loadXML($availXML); // array
		$ids = $dom->getElementsByTagName( "hotelID" );
		$id = $ids->item(0)->nodeValue;
		$names = $dom->getElementsByTagName( "hotelName" );
		$hotelName = $names->item(0)->nodeValue;
		$errors = $dom->getElementsByTagName( "error" );
		$errorDesc = $errors->item(0)->nodeValue;
		$propertyListing = "<h3>". $hotelName . "&nbsp;:&nbsp;Select a Room Type</h3>"; 
		if(!empty($errorDesc))
		{
			$propertyListing = $propertyListing . "<p>". $errorDesc . "</p>"; 
		}
		else
		{
		$rateNodes = $dom->getElementsByTagName( "Rate" );
		foreach( $rateNodes as $rateNode )
		{
			$supplierID = $rateNode->getAttribute('supplierID');
			$chainCode = $rateNode->getAttribute('chainCode');
			$propertyID = $rateNode->getAttribute('propertyID');
			$rateCodes = $rateNode->getElementsByTagName( "rateCode");
			$rateCode = $rateCodes->item(0)->nodeValue;
			$rateDescrip = $rateNode->getElementsByTagName( "rateDescription");
			$rateDescription = $rateDescrip->item(0)->nodeValue;
			$hotels = $rateNode->getElementsByTagName( "Room" );
			$hiderow = 0;
			foreach( $hotels as $hotel )
			{
				$hotelNode = $hotel->getElementsByTagName( "roomCode" );
				$roomCode = $hotelNode->item(0)->nodeValue;
				$hotelNode = $hotel->getElementsByTagName( "roomDescription" );
				$roomDescription = $hotelNode->item(0)->nodeValue;
				$hotelNode = $hotel->getElementsByTagName( "rate" );
				$rate = $hotelNode->item(0)->nodeValue;
				$hideval = $rate."~".$rateCode."~".$rateDescription."~". $roomCode."~".$roomDescription."~".$supplierID."~".$chainCode."~".$propertyID;
				$propertyListing = $propertyListing . "<br><div id=availleft>$" .$rate. "<span class=taxnote>*</span><input type=hidden name=rowid".$hiderow." value='".$hideval. "' /><br>";
				$propertyListing = $propertyListing . "<input type='button' class='submit' value='Book it' onClick='javascript:populateSelected(\"".$hideval."\")'/></div>";
				$propertyListing = $propertyListing . "<div id=availright><div class=roomdescription>" . $roomDescription . "</div></div><span class=taxnote2>* Base rate.  Taxes/Fees will show on next page.</span><div id=clear><hr size='1' width='90%'></div>";
				++$hiderow;
			}
		}
	}
?>

and the js in the html:
Code:
<script language="javascript">
function populateSelected(s)
{
alert(s);
document.bookHotel.selectedRoom.value = s;
document.bookHotel.submit();
}
</script>
and the form:
Code:
<form method="post" action="[URL unfurl="true"]https://www.alltrips.com/ihs/hotel_book.php"[/URL] name="bookHotel">
<input type="hidden" name="hotelID" value="<?=$hotelID ?>"/>
<input type="hidden" name="arrivalDay" value="<?=$arrivalDay ?>"/>
<input type="hidden" name="arrivalDay" value="<?=$arrivalMonth ?>"/>
<input type="hidden" name="departureDay" value="<?=$departureDay ?>"/>
<input type="hidden" name="departureMonth" value="<?=$departureMonth ?>"/>
<input type="hidden" name="numberOfAdults" value="<?=$numberOfAdults ?>"/>
<input type="hidden" name="numOfRooms" value="<?=$numOfRooms ?>"/>
<input type="hidden" name="numberOfChildren" value="<?=$numberOfChildren ?>"/>
<input type="hidden" name="inDate" value="<?=$inDate ?>"/>
<input type="hidden" name="outDate" value="<?=$outDate ?>"/>
<input type="hidden" name="selectedRoom" value=""/>
<? echo $propertyListing ?>
</form>
 
and here is the code on the hotel_book.php page. i'm thinking that the $hideval variable is being overwritten, but interested in hearing some feedback

Code:
<? session_start(); 
//**STEP 1 & 2 INCLUDES MUST BE THE TOP MOST LINES ON THE PAGE**
//**STEP 1 (FUNCTIONS) MUST BE INCLUDED BEFORE STEP 2 (LIBRARY)**
// STEP 1: INLCUDE SERVER AJAX FUNCTIONS 
   include ("../ajaxserverfx.php"); 
// STEP 2: INCLUDE AJAX AGENT LIBRARY 
   include_once("../ajaxagent.php");
// IHS Integration
	include_once "../ihsHttpRequest.php";
		$baseurl = "[URL unfurl="true"]http://xml.ihsadvantage.com/xmlhotel.jsp?xml=";[/URL]
		$f = 1;
		$c = 2;//1 for header, 2 for body, 3 for both
		$r = NULL;
		$a = NULL;
		$cf = NULL;
		$pd = NULL;
		
		// 	Posting Variables already acquired from previous requests.
		$hotelID = $_POST['hotelID'];
		$arrivalDay = $_POST['arrivalDay'];
		$arrivalMonth = $_POST['arrivalMonth'];
		$departureDay = $_POST['departureDay'];
		$departureMonth = $_POST['departureMonth'];
		$numberOfAdults = $_POST['numberOfAdults'];
		$numOfRooms = $_POST['numOfRooms'];
		$numberOfChildren = $_POST['numberOfChildren'];
		$selectedRoom = $_POST['selectedRoom'];
		$inDate =  $_POST['inDate'];
		$outDate =  $_POST['outDate'];
		$supplierID =  $_POST['supplierID'];
		
		// Hotel Info Request
		$hotelQueryStr = "<HotelSessionRequest%20method=\"runHotelInfoRequest\"><HotelInfoRequest><hotelID>".$hotelID."</hotelID></HotelInfoRequest></HotelSessionRequest>";
		// echo $hotelQueryStr;	
		$url = $baseurl . $hotelQueryStr;
		// echo $url;
		$hotelXML = open_page($url,$f,$c,$r,$a,$cf,$pd);
		$hotelXML = str_replace('US-ASCII','utf-8',$hotelXML);
		// echo $hotelXML;
		$dom = new DOMDocument();
		$dom->loadXML($hotelXML); // array
		$hotels = $dom->getElementsByTagName( "HotelInfo" );
		$propertyListing = "";
		foreach( $hotels as $hotel )
			{
			$ids = $hotel->getElementsByTagName( "hotelID" );
			$id = $ids->item(0)->nodeValue;
			$names = $hotel->getElementsByTagName( "hotelName" );
			$hotelName = $names->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "propertyDescription" );
			$description = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "locationDescription" );
			$locDescription = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "checkIn" );
			$chkIn = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "checkOut" );
			$chkOut = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "numberOfRooms" );
			$noRooms = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "numberOfFloors" );
			$noFloors = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "numberOfSuites" );
			$noSuites = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "nativeCurrencyName" );
			$currency = $hotelNode->item(0)->nodeValue;
			$hotelInfo = $hotel->getElementsByTagName( "address1" );
			$address = $hotelInfo->item(0)->nodeValue;
			$hotelInfo = $hotel->getElementsByTagName( "city" );
			$address = $address . "&nbsp;-&nbsp;". $hotelInfo->item(0)->nodeValue;
			$hotelInfo = $hotel->getElementsByTagName( "stateProvince" );
			$address = $address . ",&nbsp;". $hotelInfo->item(0)->nodeValue;
			$hotelInfo = $hotel->getElementsByTagName( "postalCode" );
			$address = $address . "&nbsp;&nbsp;". $hotelInfo->item(0)->nodeValue;
			$hotelInfo = $hotel->getElementsByTagName( "country" );
			$address = $address . "&nbsp;-&nbsp;". $hotelInfo->item(0)->nodeValue;
			$Rates = $hotel->getElementsByTagName( "Rate" );	
		foreach( $Rates as $rate )
			  {
				$commissions = $rate->getElementsByTagName( "commission" );
				$commission = $commissions->item(0)->nodeValue;
				if (!empty($commission)) 
					{
					$commission = "No Commission";
					}
				}
		$i = 0;
		$amenities = $hotel->getElementsByTagName( "Amenity" );
		foreach( $amenities as $amenity )
			{
				$names = $amenity->getElementsByTagName( "description" );
				$name = $names->item(0)->nodeValue;
				$amenitylist = $amenitylist . "<li>" . $name . "</li>&nbsp;"; 
			}
		$amenities = "";
		if (!empty($attractions))
			{
				$attractionPop = "<div id=\"attractions\" style=\"position:absolute;visibility:hidden; left:56; top:922; width:244\"><ul>";
				$attractionPop = $attractionPop . $attractions . "</ul></div>";
			}
		$i = 0;
		$restMedias = $hotel->getElementsByTagName( "Media" );
		foreach( $restMedias as $media )
			{
				$links = $media->getElementsByTagName( "link" );
				$link = $links->item(0)->nodeValue;
				if ($i == 0)
					$mainImage = $link;
				else	
					$restImages = $restImages . "<td><img width=100 height=100 src=[URL unfurl="true"]http://"[/URL] . $link . " /></td><td>&nbsp;</td>"; 
				$i += 1;
			}
			$propertyListing = $propertyListing . "<div id=booktopleft><img width=100 height=100 src=[URL unfurl="true"]https://"[/URL] . $mainImage . " /></div>";
			$propertyListing = $propertyListing . "<div id=booktopright>". $address ."<br>Check In : " .$chkIn. "<br>";
			$propertyListing = $propertyListing . "Check Out : " .$chkOut. "<br>";
			$propertyListing = $propertyListing . "Number of Rooms : " .$noRooms. "<br>";
			$propertyListing = $propertyListing . "Number of Floors : " .$noFloors. "</div>";
			}
			$curMonthDays = "";
			$dd = (int) (date('d'));
			++$dd;
			for($i=1; $i <= date('t');$i++)
			{
				if($dd == $i) 
					$curMonthDays .= "<option value='" .$i. "' selected>" .$i. "</option>" ;
				else 
					$curMonthDays .= "<option value='" .$i. "'>" .$i. "</option>" ;
			}
			$hotelNode = $hotel->getElementsByTagName( "cancelPolicyDescription" );
			$cancelPolicyDescription = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "roomRate" );
			$roomrate = $hotelNode->item(0)->nodeValue;
			$hotelNode = $hotel->getElementsByTagName( "number" );
			$number = $hotelNode->item(0)->nodeValue;


		// Availability Request
		//ihs	I believe you could post the values from the previous page
		//		and not include the Availability Request here.
		$availQueryStr = "<HotelSessionRequest%20method='runHotelAvailRequest'>";
		$availQueryStr = $availQueryStr . "<HotelAvailRequest>";
		$availQueryStr = $availQueryStr . "<hotelID>" .$hotelID. "</hotelID>";
		$availQueryStr = $availQueryStr . "<inDate>" .$inDate. "</inDate>";
		$availQueryStr = $availQueryStr . "<outDate>" .$outDate. "</outDate>";
		$availQueryStr = $availQueryStr . "<numberOfAdults>" .$numberOfAdults. "</numberOfAdults>";
		$availQueryStr = $availQueryStr . "<affiliateID>5469</affiliateID>";
		$availQueryStr = $availQueryStr . "<numOfRooms>" .$numOfRooms. "</numOfRooms>";
		$availQueryStr = $availQueryStr . "<numberOfChildren>" .$numberOfChildren. "</numberOfChildren>";
		$availQueryStr = $availQueryStr . "<supplierID>0</supplierID>"; // supplierID = 0 for searching
		$availQueryStr = $availQueryStr . "</HotelAvailRequest>";
		$availQueryStr = $availQueryStr . "</HotelSessionRequest>";
		// echo $availQueryStr;	
		$url = $baseurl . $availQueryStr;
		// echo $url;
		$availXML = open_page($url,$f,$c,$r,$a,$cf,$pd);
		$availXML = str_replace('US-ASCII','utf-8',$availXML);
		// echo $availXML;
		$dom = new DOMDocument();
		$dom->loadXML($availXML); // array
		$ids = $dom->getElementsByTagName( "hotelID" );
		$id = $ids->item(0)->nodeValue;
		$names = $dom->getElementsByTagName( "hotelName" );
		$hotelName = $names->item(0)->nodeValue;
		$errors = $dom->getElementsByTagName( "error" );
		$errorDesc = $errors->item(0)->nodeValue;
		$propertyListing = "<h3>". $hotelName . "&nbsp;:&nbsp;Select a Room Type</h3>"; 
		if(!empty($errorDesc))
			{
				$propertyListing = $propertyListing . "<p>". $errorDesc . "</p>"; 
			}
		else
			{
				$rateNodes = $dom->getElementsByTagName( "Rate" );
				foreach( $rateNodes as $rateNode )
				{
					$supplierID = $rateNode->getAttribute('supplierID');
					$chainCode = $rateNode->getAttribute('chainCode');
					$propertyID = $rateNode->getAttribute('propertyID');
					$rateCodes = $rateNode->getElementsByTagName( "rateCode");
					$rateCode = $rateCodes->item(0)->nodeValue;
					$rateDescrip = $rateNode->getElementsByTagName( "rateDescription");
					$rateDescription = $rateDescrip->item(0)->nodeValue;
					$hotels = $rateNode->getElementsByTagName( "Room" );
					$hiderow = 0;
					foreach( $hotels as $hotel )
					{
						$hotelNode = $hotel->getElementsByTagName( "roomCode" );
						$roomCode = $hotelNode->item(0)->nodeValue;
						$hotelNode = $hotel->getElementsByTagName( "roomDescription" );
						$roomDescription = $hotelNode->item(0)->nodeValue;
						$hotelNode = $hotel->getElementsByTagName( "rate" );
						$rate = $hotelNode->item(0)->nodeValue;
						$hideval = $rate."~".$rateCode."~".$rateDescription."~". $roomCode."~".$roomDescription."~".$supplierID."~".$chainCode."~".$propertyID;
					}
				}
			}
			
        // Rule Request 
 		$ruleQueryStr = "<RulesRequest%20method='processHotelRules'>";
		$ruleQueryStr .= "<HotelRulesRequest>";
		$ruleQueryStr .= "<hotelID>".$hotelID."</hotelID>";
		$ruleQueryStr .= "<roomRate>".$rate."</roomRate>";
		$ruleQueryStr .= "<inDate>".$inDate."</inDate>";
		$ruleQueryStr .= "<outDate>".$outDate."</outDate>";
		$ruleQueryStr .= "<propertyID>".$propertyID."</propertyID>";
		$ruleQueryStr .= "<chainCode>".$chainCode."</chainCode>";
		$ruleQueryStr .= "<numberOfAdults>".$numberOfAdults."</numberOfAdults>";
        $ruleQueryStr .= "<rateCode>".$rateCode."</rateCode>";
		$ruleQueryStr .= "<roomCode>".$roomCode."</roomCode>";
		$ruleQueryStr .= "<supplierID>".$supplierID."</supplierID>";
		$ruleQueryStr .= "<affiliateID>5469</affiliateID>";
		$ruleQueryStr .= "<numberOfRooms>".$numOfRooms."</numberOfRooms>";
		$ruleQueryStr .= "<numberOfChildren>".$numberOfChildren."</numberOfChildren>";
		$ruleQueryStr .= "<currencyCode>USD</currencyCode>";
		$ruleQueryStr .= "<wantsRateRules>true</wantsRateRules>";
		$ruleQueryStr .= "<timeout>5000</timeout>";
		$ruleQueryStr .= "<rateChange>true</rateChange>";
		$ruleQueryStr .= "<numberOfBeds>1</numberOfBeds>";
		$ruleQueryStr .= "</HotelRulesRequest>";
		$ruleQueryStr .= "</RulesRequest>";
		//	echo $ruleQueryStr;
		$ruleurl = $baseurl . $ruleQueryStr;
		//	echo $ruleurl;
		$ruleXML = open_page($ruleurl,$f,$c,$r,$a,$cf,$pd);
	    $ruleXML = str_replace('US-ASCII','utf-8',$ruleXML);
		// echo $ruleXML;		
		$dom = new DOMDocument();
	    $dom->loadXML($ruleXML); // array
		$rateNodes = $dom->getElementsByTagName( "Rate" );
		foreach( $rateNodes as $rateNode )
		{
			$tax = $rateNode->getElementsByTagName( 'taxInformation' );			
			$tax_data = $tax->item(0)->nodeValue; 
			$rateDesc = $rateNode->getElementsByTagName( 'rateDescription' );			
			$rateDesc_data = $rateDesc->item(0)->nodeValue;
		}
		$roomNodes = $dom->getElementsByTagName( "Room" );
		foreach( $roomNodes as $roomNode )
		{
			$cpd = $roomNode->getElementsByTagName( 'cancelPolicyDescription' );			
			$cpd_text = $cpd->item(0)->nodeValue;
			$pppd = $roomNode->getElementsByTagName( 'prePayPolicyDescription' );				
			$pppd_text = $pppd->item(0)->nodeValue;		
			$total_rate	= $roomNode->getElementsByTagName( 'totalRate' );		
			// $total_rate_text = $total_rate->item(0)->nodeValue;			
		}		
		$roomNodes = $dom->getElementsByTagName( "Night" );	    
		foreach( $roomNodes as $roomNode )
		{
			$dayName = $roomNode->getElementsByTagName( 'dayName' );			
		    $dayName_text = $dayName->item(0)->nodeValue;					
			$month = $roomNode->getElementsByTagName( 'monthName' );			
		    $month_text = $month->item(0)->nodeValue;
			$day = $roomNode->getElementsByTagName( 'day' );			
		    $day_text = $day->item(0)->nodeValue;	
			$rate = $roomNode->getElementsByTagName( 'rate' );	
		    $rate_text = $rate->item(0)->nodeValue;				
		}	echo $hideval;							
?>
 
why are you storing so much redundant data in each hotel booking form? why not just store a single 'offer' id?
 
a few reasons:

1. this is my first php project. i don't really know what i'm doing and learning as i go.

2. this was dropped in my lap after it was written by a guy half way across the world and i have yet to talk with him and figure out why he did it this way. he is unreachable.

your feedback is much appreciated, but i don't quite understand what you are getting at. any chance you could clarify/specify. i agree that the hotel_book page is full of crap that doesn't need to be there, but i have a hard time isolating what can be simplified.
 
I don't know much about XML databases, however some things do stand out to me here.

1st, numberOfBeds is statically set to 1

2nd, (might be related to first issue) I can select 0 adults and 0 children and get the same price as 4 adults and 4 kids. or this could be a problem in the hotel_book.php file but you didn't offer any code for it.

Anothing thing, looking at the source code of a generated page I see this:

Code:
<input type=hidden name=rowid0 value='195.00~RAC~Lodging Only-Stillwater Studio  *Rack Sws~DST~Stillwater Studio Queen Wall Bed Or Sofa Bed  *Stillwater Condominiums Are Affordable And Convenient. Walk To The Mountain Mall And~1~UZ~14275' />

Your including all this room data into the page and you never use it, instead your relying on javascript and the submit button to insert data into the form. (Doing it this way I wouldn't use a 'submit' button, just use a normal button and use javascript to submit the form when done, this way if someone has javascript disabled it wont submit the form missing information.


Second, your submit button doesn't properly close!

<input type='submit' class='submit' value='Book it' onClick='javascript:populateSelected("195.00~RAC~Lodging Only-Stillwater Studio  *Rack Sws~DST~Stillwater Studio Queen Wall Bed Or Sofa Bed  *Stillwater Condominiums Are Affordable And Convenient. Walk To The Mountain Mall And~1~UZ~14275")' [red]</input>[/red] 


I recommend you change the code to be something like this:

<input type='button' class='submit' value='Book it' onClick='javascript:populateSelected("195.00~RAC~Lodging Only-Stillwater Studio  *Rack Sws~DST~Stillwater Studio Queen Wall Bed Or Sofa Bed  *Stillwater Condominiums Are Affordable And Convenient. Walk To The Mountain Mall And~1~UZ~14275");'>
I strongly agree with jpadie, you really should consider offer id's instead of passing so much data back and forth needlessly.

Also in case you didn't know, your php script is drawing all the offers on a single line. You might want to think about adding some line breaks. Would make the file much easier to debug.
 
I am not seeing the error. If I click on "book it" the rate that is sent over is the correct one.

Your page does show some JS errors, but other than that I get the correct rate once I hit book it.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
You get a rate, but go back and rebook with different options. I got the same rate and sometimes got a really bogus rate.
For example it said at the top my rate was 159 or something and below my final rate was 800.

I ran all tests for a single day, not two days. Don't know if that changes the output.

Look at the output code of hotel_availability.php, I'm really surprized the page draws correctly, IE must be pretty tolerant. And yes, I see Javascript errors as well.
 
Another thing I just noticed when looking at the output code, you have php being drawn as commented out html..

Code:
<!--
Sets selectedRoom variable in the form below.
Calls function on the button click and after the selectedRoom form field's value is set it submits the form.
//selectedRoom value
$hideval = $rate."~".$rateCode."~".$rateDescription."~". $roomCode."~".$roomDescription."~".$supplierID."~".$chainCode."~".$propertyID;
$propertyListing = $propertyListing . "<br><div id=availleft>$" .$rate. "<input type=hidden name=rowid".$hiderow." value='".$hideval. "' /><br>";
//Sets the onclick function to call the javascript funtction to set the selectedRoom value.
$propertyListing = $propertyListing . "<button value='submit' class='submitBtn' onClick='javascript:populateSelected(\"".$hideval."\")' <span>Book It</span></button></div>";
-->

Also what is this about?
Code:
<script language="javascript" src="../master.js"></script>
[red]<!--Test to move this inside the head tags to see if we get duplicate visitor clicks - bjhansen 06/07/07 -->[/red]
 <script type="text/javascript" src="?ajaxagent=js&this_url=%2Fihs%2Fhotel_availability.php">
</script>

I've reread your post, I can't really figure out 'what' your asking help with? What is the exact problem you are trying to address or the feature you are trying to enable?
 
Still not seeing the error, I can go back and select another rate and it still gives me the correct rate.

Whether I choose a single day or 2 days or whatever.

I did notice the fact that the form doesn't require you to specify a number of adults, it will just submit it blank no problem, which is certainly not right.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thats kinda my point.

I just ran a search in two windows, one with 4 adults 4 kids, the second with 0 adults 0 kids.

Now under the same listing I get two different prices..
Whitewater Hotel 2 Queen ...
0adults0kids - 154.00
4adults4kids - 204.00
0adults4kids - 154.00
1adults0kids - 129.00
1adults4kids - 129.00

The kids field isn't even being used, adults seems to be defaulting to a higher number if 0 selected.

All in all, there needs to be a better breakdown on how rates are calculated. The lack of details on rates would make me shy away from this site if I was looking to rent a hotel. (Not to mention the google maps showing it in the middle of no-where...yikes!)
 
Ignore my second line on that last post, I ran a few more than two searches. :)
 
thanks for looking at this everyone.

i understand i was pretty vague with my questions. i actually had a chance to catch my breath and then dig back into the code. the final product is now working (as of 5pm mtn time), but as it has been pointed out, this project is full of junk code. thanks to everyone for taking a look. i really appreciate getting a couple other pairs of eyes on it. once i have a finalized version i will make one final post to show where the problems were!
cheers,
sam
 
sam

can you step back and show us what the structure of your database is? we then might be able to drum up some proof of concept code to set you on the right track for a cleaner solution. you won't have to recode the html, of course.
 
wow...

i've deleted, rewritten and altered so much of this i'm not even really sure noting the fixes will offer much other than a look at frankenstein's monster.

thanks again to all for having a look. i'm realizing right now that my post was a little preemptive and i just needed to step away for a bit before addressing the problems.

if, however, you do find something you are curious about or want to learn a little more, please don't hesitate to post a quesiton here. i've subscribed to the thread and would love to offer any help if i can.
cheers,
sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top