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>"
}
?>

Specify your error and it's location. (use code tags for your code)

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

Thank you Ezzaral

Is this topic still unsolved?

Yes Nahiyan,

Please help.

You still haven't stated the error you get.

It only display a blank page without error

The first thing I note is the missing ; in line 56 in the above listing.

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.

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

Thanks for helping

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

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

include()

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.

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).

ok
This is the link: http://www.sunshineorlandorentals.com/vacation-rental/305
Pls try and book, submit, fill the form then submit. That is where the blank page comes up.

The issue is not joomla, it is the php code, cos if i remove the php code the page works fine.

Thank you for your time and help.
I really appreciate.

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.

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.

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.

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

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.

Thank you very much for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.