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.
Related
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
I am learning PHP. Currently, I have:
<?php
echo "<p>This text was brought to you by PHP.</p>";
?>
What this does is outputs "This text was brought to you by PHP." and then on the next line: "; ?>
I cant figure out what i'm doing wrong, the code is seemingly correct.
PS. I made sure its a php file.
You cannot run a php file off the filesystem (file://) you need to install a web server with php enabled and then the server side code will run.
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 9 years ago.
Improve this question
I'm a PHP newbie trying to debug someone's code. The very first line of the code has what I think is a constant as shown below:
<?php
set_time_limit (0);
require_once (SITE_PATH. '/server/php/libs/dbase/handler.php');
I have written a debug statement and I have gotten a null.
echo "SITE_PATH"
How should PHP constants be declared. Should'nt the require statement be $SITE_PATH instead of SITE_PATH?
php constants must be defined as :
define('SITE_PATH','http://localhost/site');
and are used as :
echo SITE_PATH;
Look at this : php constants
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.
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
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 am trying to separate my code into functions to make it more readable.
I made a function to update a field in a database. What I am trying to do is that when they change the username it goes to update Account function then updates the session variable , the smarty var,and the database regarding the name.
Everything gets updated after the form is submitted but the smarty variable and I can't figure out why(i know its something to do with the scope) because if i declare it out of the function it works fine.
All the magic that i need fixed is in the Home portion of the routing section of my code. Thank you for any help :)
code :http://pastebin.com/VdRPz3hc