How to echo a hyperlink with a variable? [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Getting these hyperlinks right and mixing HTML with PHP seems to be a constant source of sorrow for me. Whats wrong with this hyperlink?
echo '$suggestion[$ss_count]<br>;

it should be
echo ''.$suggestion[$ss_count].'<br>';
Within single quotes variables are not interpolated so you have to pull the link text out of the string literal.

try it ..!!
echo ''.$suggestion[$ss_count].'<br>';

you all missing the point.
JUST USE BACKSLASH

Related

Disappears \ from db value [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want to save XO/YEr\fae?3 in a mysql table.while inserting this value \ disappears and only saved XO/YErfae?3.Is it possible to insert \ in database?Please help
Its because characters after backslash are escaped by the PHP interpreter.
You can replace your code with the following :
XO/YEr\\fae?3

Php passing variable names [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Can someone please explain to me what this piece of php code means.
echo "<a href='product.php?product_id".$product_id."'>
Is it saying that the link is taken from a variable from the product.php page and its named $product_id?
This is a GET parameter in the URL (it's also wrong btw). Say $product_id = 1.
echo "<a href='product.php?product_id".$product_id."'>
This would be "product.php?product_id1"
echo "<a href='product.php?product_id=".$product_id."'>
This would be "product.php?product_id=1", which would would handle by using
$_GET["product_id"]; //yields 1
Ths snippet outputs an HTML <a> tag. The $product_id is a variable, and echo is the command to output a string.
But I'd recommend to follow some basic Tutorials about HTML and PHP, as these are some of the most basic things.

Twig variable does not exist if the name contains underscores [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I can’t display a variable like {{foo_bar}}, but if I change the name to fooBar it works. How can I display variables that contain underscores?
I think it's okay if you display variables that contain underscores. There is no error with it.

Not Entering Values into the database [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
mysql_query("insert into user_info(Name,Id,Password,Email,Gender,Date_of_birth) values('".$name."','".$iden."','".$pass1."','".$email."','".$gender."','STR_TO_DATE('$date','%d,%m,%Y')')");
Can anyone tell which part of this code is incorrect, as it is not entering anything in the database.....
Unquote the 'STR_TO_DATE('$date','%d,%m,%Y')' call. I also cleaned up the rest of the code a bit. As a result you get:
mysql_query("insert into user_info(Name,Id,Password,Email,Gender,Date_of_birth) values('$name','$iden','$pass1','$email','$gender',STR_TO_DATE('$date','%d,%m,%Y'))");
On this part:
'STR_TO_DATE('$date','%d,%m,%Y')'
There are single quotes inside single quotes, causing an error. To fix this, replace the single quotes on the arguments to escaped double quotes, like this:
'STR_TO_DATE(\"$date\",\"%d,%m,%Y\")'
However, since you probably want to use the function and not post it literally, you should just remove the outside quotes, like this:
STR_TO_DATE('$date','%d,%m,%Y')

how do i display id on page using php [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
On THIS PAGE, I have the word "category =" before my campaigns.
My problem is: I am unable to find the code that can display the page id as shown in the url.
How can I get this to echo the page id as shown in the URL? to say "category = FREE".
can someone please help me.
thank you.
echo "category = ", htmlspecialchars($_GET['id']);
Any URL parameter can be retrieved using $_GET["param_name"], in your case: $_GET["id"]. You can save that as a variable, or echo it right away.

Categories