Have 2 issues. Firstly i have a text link which gives me a URL i want but this will not work correctly because it gives me my webpage URL first followed by the URL i want, ie www.wheels4rent.net/www.thrifty.co.uk/cgi-bin....etc. I need the www.wheels4rent.net removed.

Secondly the 'book now' link i want replaced with a button instead and the button should do the same as the 'book now' link. Please help!!! You can see problems by visiting http://www.wheels4rent.net and adding parameters then click quote which will take you then to list_car1.php page and this is where i have the problem. See code for list_car1.php below



echo "<br><strong/>Pick up Location: ".$xmlDoc->hire->locname."<br> Drop-off Location: ".$xmlDoc->hire->locdrop."<br>Pickup Time: ".disp_date($xmlDoc->hire->pickupdate)." ".$xmlDoc->hire->pickuptime."<br>Dropback Time: ".disp_date($xmlDoc->hire->dropbackdate)." ".$xmlDoc->hire->dropbacktime."<br>";

echo "<table border=1 style='font:12px verdana' cellspacing=0 cellpadding=3><tr><td>Car Type</td><td>Description</td><td>Rate</td></tr>";

foreach($xmlDoc->car as $car)
$url = (string)$car->book;
echo "<tr><td width=200px><img src='".$car->carimage."' align='right' style='padding:1px; width:100px'><b>".$car->cartype."</b><br>".$car->carsipp."<br>".$car->transmission."</td><td><b>".$car->carexample."</b></td><td><b>&pound;".$car->price."
</b><br>Unlimited Miles</b><br><a href='$url'>book now<input type='submit' name='book' value='book'/></a></td></tr>";


echo "</table>";

Member Avatar

I don't understand why you have a submit button inside a link. Doesn't make sense to me. What's wrong with placing all this inside a form tag with the appropriate action attribute? If you really have to use a querystring as opposed to using POST, you gan send the form via method=get.

You can use a plain button with a onclick attribute to do a js redirect with url. However, if you have a number of items each with a book now button, onclick becomes tiresome, even if it is produced dynamically with php. So, you can use an event handler to take care of button clicks (jQuery has easy solutions).