I finally got things together and now the echo is not working can someone tell me what I am doing wrong? The page I want to echo is working fine I just cant echo the information to another page.

Thank you.

Here is the echo page.

echo '<a href="http://mywebsite.com/index.php?text=this">';

The code of the page I am trying to echo

<?php $text = $_GET['text'];
if (!$text) {die('No text selected');}
elseif($text=='this') {echo 'This Text goes here'; }
elseif($text=='that') {echo '1'; }

All we are trying to do is echo the content of the sections to another page.


Rather then doing if (!$text) , try doing if (empty($text)) .

Or, better yet, design your if statements so anything you don't expect falls through to the "else" clause:

$value = trim($_GET['text']);
if($value == "somethin") {
  ehco "We got something!";
else if($value == "something else") {
  echo "No, we got something else!";
else {
  echo "We got noting.";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.