0

Please can some help me with the error in the code below.

thank you in anticipation.

<?php $obj = new Unit();
{
global $database;
$Unit = $obj->select_row_query
("SELECT `reservation_extras` FROM `".$obj->get_table_name()."` 
WHERE `id` = '".$_GET['PropertyId']."' AND `published` = 1", 1);
$rexzz=explode(",", $Unit->reservation_extras);
$i=0;
$total_ext=0;
if(!empty($Unit->reservation_extras)||$Unit->reservation_extras=='[end]');
}
foreach($rexzz as $rexz)
{
$i++;$rexzz=explode("|",$rexz);
$database->setQuery("SELECT * FROM `jos_bookman_extras` WHERE `id`=".$rexzz[0]);
$exts=$database->loadObjectList();
echo "<tr><td align='center'>";
foreach($exts as $ext)
{
echo $ext->name;
} 
echo "<input type='hidden' value='".$ext->name."' name='ext_name".$i."' /></td>
<td align='center'>"; if($rexzz[1]==1)echo "Daily";else echo "One Time";
echo "<input type='hidden' value='".$rexzz[1]."' name='chargetype".$i."' /></td>
<td align='center'>"; echo "<select name='quantity".$i."'>";
for($j=0;$j<=$rexzz[3];$j++)
{echo "<option ";
if($_POST['quantity'.$i]==$j)echo "selected";
echo " value='".$j."'>0".$j."</option>";
}
echo "</select>";
echo "</td>
<td align='center'>";
if($rexzz[1]==1)
{
echo "<select name='days".$i."'>";
for($j=0;$j<=$days;$j++)
{
echo "<option ";
if($_POST['days'.$i]==$j)echo "selected";
echo " value='".$j."'>0".$j."</option>";
} 
echo "</select>";
}
else echo "<input type='hidden' value='' name='days".$i."' />";
echo "</td><td align='center'> $ ".$rexzz[2];
echo "</td><td align='center'> $ ";
if(!empty($_POST['quantity'.$i]))
 {
if($_POST['days'.$i]=='') echo ($_POST['quantity'.$i]*$rexzz[2]);
else echo ($_POST['days'.$i]*$_POST['quantity'.$i]*$rexzz[2]);
$total_ext+=$_POST['days'.$i]*$_POST['quantity'.$i]*$rexzz[2];
} 
else echo "0";
echo "<input type='hidden' name='cost".$i."' value='".$rexzz[2]."' />";
echo "</td></tr>"
}
?>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

5
Contributors
22
Replies
23
Views
6 Years
Discussion Span
Last Post by lobebe
0

How are we supposed to help you if we don't even know what the error is? Please tell us the error u r recieving and the line number

0

Also there are two $ signs which are maybe being interpreted as a variable (lines 46 an 47). Try to escape them like this \$ or put string within single quotes.

0

Hello broj1, i have corrected the stated errors but it is still the same.

Thanks for helping

0

And also set php.ini configuration to display errors or use directive ini_set('display_errors', 1) to set configuration temporarily in a script.

Sorry for broken posts, I am doing many things at once :-)

0

Where is the definition of your class Unit? Is it in the include path or should you include it with include() ?

0

I have set the error display in php.ini but it is still giving blank page without error. I am actually using joomla and the php code is included in the code to query for info.

Can i send you the link to see it.

Thank you for your help.

0

I am not familiar with Joomla. Do send the link maybe someone else might find the cause of the error. I will have time to look at it tomorrow (just about to leave).

0

I have clicked on above link, booked a home from 09/04/2011 to 09/08/2011, filled in the form and submited. I got a nice page with my reservation details. I can send you a snapshot but am not sure wheter is it possible through the forum.

0

yep, thank you i was able to work on it yesterday after you left, but i still have one issue with the page. The column for reservation extra is not working fine. What it is suppose to do, is for people to be able to add extra to their booking (e.g pool heat) but when quantity is selected, the days should be enable to select the number of days but it is not doing so.

Thank you so much for your time and help.

0

You should check the value of $days in the for loop in lines 37 to 42 that generate <option> tag values starting from 0 and up to $days. In generated HTML it is only one value for <option> tag (00). From the code published in your post I can not find where value for $days comes from.

0

Thank you, value of days should come from the booking dates, how can i do that?

0

I am not sure if I can answer that. I presume that $days should be assigned a value which is the difference between the arrival date and the departure date which are two forms back. So in the first form you should save this two dates either in a session ($_SESSION array on the server) or in a cookie or carry them over from form to form with GET (or POST) and hidden fields. But I am only guessing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.