Forum Moderators: coopster
$tablecolour = "red";
//
//Check to see what type of id we are handling
//
if ($dbtable == $tablecolour){
$id_type = red_id;}
else{
$id_type = blue_id;}
If I echo $dbtable the ouput is red.
If I echo $id_type the output is blue_id.
Anyone spot the problem?
$dbtable = 'red';
$tablecolour = "red";
//
//Check to see what type of id we are handling
//
if ($dbtable == $tablecolour){
$id_type = 'red_id';
}
else{
$id_type = 'blue_id';
}
echo $id_type;
I am using $dbtable = $_POST['dbtable']; (posting from a form) to get the value of $dbtable. If I echo $dbtable the output is 'red'.
I replaced my code with yours which works fine, I then replaced $dbtable= 'red'; with the original code $dbtable = $_POST['dbtable'];
Making this change somehow stops it from working.
<input name="dbtable" type="hidden" id="dbtable" value="<?PHP echo " $dbtable";?>" />
I had accidently added a space beore $dbtable when echoing it out in the hidden form.
Can't believe I have wasted so much time on that problem..I suppose that's programming though.
Thanks for your help Chimp.