I have this seemingly simple piece of PHP in my website:
<?php
$_GET["sid"];
if ($sid=="83893")
$survey="Survey Name";
?>
That should make $survey "Survey Name," right?
Later in my page, I have
<h3>Thank You For Participating In The <?php echo $survey; ?></h3>
If the user goes to mypage.php?sid=83893, instead of it echoing "Survey Name" it doesn't show anything? Why is this?
As expected, if I simply put
Thank You For Participating In The <?php echo $_GET["sid"]; ?>
It writes the sid, but why won't it output $survey?
You're never creating the variable $sid or assign anything to it.
Guess you're looking for $sid = $_GET['sid']; or simply if ($_GET['sid'] == 83893).
Note that you should check whether $_GET['sid'] actually exists before using it with isset($_GET['sid']). Note also that you should turn on error reporting during development, it would have helped you to catch this problem.
$sid = $_GET["sid"];
Then it will work, as you never define what $sid is
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With