Jump to content

echoing a varible shows the name of the variable


kanuski

Recommended Posts

Greetings,

I am using a drop-down menu to pass a variable, $clid with a value of '1', to the next page. When I echo it on the next page it prints $clid instead of '1'.

<? echo "CLID: $clid"; ?>

This prints

CLID: $clid

 

  The drop-down menu is in a separate txt file and works everywhere else on my site. All the other variables are working great. What could cause this kind of problem?

 

<?

$query3 = "select * from classrooms

where tid LIKE '$uid'";

$result3 = mysql_query ($query3);

$num_rows3 = mysql_num_rows($result3);

if ($data3 = mysql_fetch_array($result3))

{

echo "<SELECT name='clid' style='background-color : #a8b6e2; border-bottom-color : #677c8f; border-left-color : #677c8f; border-right-color : #677c8f; border-top-color : #677c8f;'>";

$count="0";

do

{

$clid1=$data3[0];

$classcode1=$data3[2];

 

echo "<option value='$clid1'>$classcode1</option>";

$count=$count+1;

} while($data3 = mysql_fetch_array($result3));

echo "</SELECT>";

$classrooms="yup";

}

if($num_rows3<1) { echo "<em>No classrooms created.</em>"; $classrooms="nope"; }

 

?>

 

 

Link to comment
Share on other sites

Thanks, that isn't working either.

The code I am using is actually part of a much larger section. The only reason I want to print it is to see why it is not working. I am storing this data in a database and this variable is always showing up as 0. The others work great.

echo "CLID: $clid <br>month: $month<br>mo_num: $mo_num<br>day_num: $day_num<br>";

Somehow the value of $clid is becoming $clid.

 

 

Link to comment
Share on other sites

cool = ))

 

yah, sometimes just echoing things out doesn't help... using var_dump and print_r for arrays is essential to get to the deeper issue. They're excellent troubleshooting tools. Don't feel like an idiot. You just learned something you will use a zillion times now, and start finding your problems without asking and having to wait for help. Good luck man

 

PhREEEk

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.