Replace URL strings in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alltech
    New Member
    • Sep 2011
    • 8

    Replace URL strings in PHP

    I have within cdata tags URL for example it would be www.thrifty.co.uk/cgi-bin....etc but when selecting the 'book' button i have it just gives blank page. Please help!!! Code shown below
    Code:
    foreach($xmlDoc->car as $car)
    {
    $url = (string)$car->book;
    $url = str_replace('wheels4rent.net','$url');
    
    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>
    <input type=button onclick='javascript:window.open($url);' value='Book Now'></td></tr>";
    
    
    }
    Last edited by Dormilich; Sep 27 '11, 05:13 AM.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    variables ain’t resolved in single quotes (line #4).

    and in JavaScript, string values need to be quoted (line #8).

    Comment

    Working...