By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

Replace URL strings in PHP

P: 8
I have within cdata tags URL for example it would be but when selecting the 'book' button i have it just gives blank page. Please help!!! Code shown below
Expand|Select|Wrap|Line Numbers
  1. foreach($xmlDoc->car as $car)
  2. {
  3. $url = (string)$car->book;
  4. $url = str_replace('','$url');
  6. 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."
  7. </b><br>Unlimited Miles</b><br>
  8. <input type=button onclick='$url);' value='Book Now'></td></tr>";
  11. }
Sep 26 '11 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,639
variables ain’t resolved in single quotes (line #4).

and in JavaScript, string values need to be quoted (line #8).
Sep 27 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.