kanuski Posted November 11, 2007 Share Posted November 11, 2007 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"; } ?> Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 11, 2007 Share Posted November 11, 2007 I'm not a fan of shutting php off and on a zillion times while outputting HTML, but... have you tried: <?php echo "CLID: $clid"; ?> you might need the long tag form... PhREEEk Quote Link to comment Share on other sites More sharing options...
kanuski Posted November 11, 2007 Author Share Posted November 11, 2007 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. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 11, 2007 Share Posted November 11, 2007 The only thing I can think of is somewhere, somehow $clid is accidentally defined as a string that contains literally $clid. Right before that echo, do this and post back the output: var_dump($clid); die(); PhREEEk Quote Link to comment Share on other sites More sharing options...
kanuski Posted November 11, 2007 Author Share Posted November 11, 2007 I get string(5) "$clid" Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 11, 2007 Share Posted November 11, 2007 yep.. that's it then... it's being defined somewhere else before you get to the echo. PhREEEk Quote Link to comment Share on other sites More sharing options...
kanuski Posted November 11, 2007 Author Share Posted November 11, 2007 Thanks, I found it and feel like an idiot. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 11, 2007 Share Posted November 11, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.