473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
Expand|Select|Wrap|Line Numbers
  1. foreach($xmlDoc->car as $car)
  2. {
  3. $url = (string)$car->book;
  4. $url = str_replace('wheels4rent.net','$url');
  5.  
  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='javascript:window.open($url);' value='Book Now'></td></tr>";
  9.  
  10.  
  11. }
Sep 26 '11 #1
1 1926
Dormilich
8,658 Expert Mod 8TB
variables ain’t resolved in single quotes (line #4).

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

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

Similar topics

4
by: beliavsky | last post by:
The code for text in open("file.txt","r"): print text.replace("foo","bar") replaces 'foo' with 'bar' in a file, but how do I avoid changing text inside single or double quotes? For making...
9
by: Xah Lee | last post by:
© # -*- coding: utf-8 -*- © # Python © © import sys © © nn = len(sys.argv) © © if not nn==5: © print "error: %s search_text replace_text in_file out_file" % sys.argv
1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
0
by: Off | last post by:
Hello, Is it possible to replace strings in MSWORD file (custome tags) from PL&SQL block? Off
5
by: K.Simon | last post by:
Hello, it's very often neccessary to replace strings or a single character in my stylesheets. My solution looks awful and very long. Now i thought to solve this with an array like structure but...
0
by: ianstratford | last post by:
I just released a new version of the free Microsoft Access find and replace add-in utility (version 1.5). Search and replace (optionally) any string in tables, queries, macros, forms, reports...
5
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char*...
2
by: jason | last post by:
Hello. I just converted some data to to sql2000 into a TEXT type field. I needed to remove all tabs from the data and now want to remove extra lines too. As we know, SQL2000's replace function...
7
agsrinivasan
by: agsrinivasan | last post by:
hi everyone, i have a txt file..for eg... 1. WA.1048/2005 M/S.R.SIVAKUMAR M/S.PAUL AND PAUL S.SURESH ...
5
by: neeludhiman | last post by:
Hi All, Can someone please help me with the code in C / C++ to find a string in an input text file and replace it with another string in output text file. The catch is that white spaces in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.