Hi this is the code of php which i am using
original
value="http://www.abc.com/page/123456"
code:
<?php
$url = $_GET['id'];
echo "value="http://www.abc.com/page/$url";
?>
i want to replace the 123456 everytime so i used this. But this is not working. Anything wrong here?
Php code issue
Moderator: General Moderators
Re: Php code issue
You echo statement line is wrong. It is not properly quoted.
Code: Select all
echo "value=\"http://www.abc.com/page/$url\"";Re: Php code issue
My personal recommendation here is to use single quotes for the PHP echo statements. That way, when you're mixing it with HTML tags that have double quoted attributes, you don't need to throw in those escape characters. You will, however, have to concatenate variables. See the example below.
Code: Select all
$url = $_GET['id'];
echo 'value="http://www.abc.com/page/', $url ,'"';