Variable Value

A

Anonymous

Guest
try:

<td><a href="handlecity.php?sid=<? echo $sid ?>&vcity=<? echo $Row['city'] ?>&vstate=<? echo $Row['state'] ?>"><? $Row['city'] ?></a></td><br>

That's a different way of writing it and usually works for me.

Andrew
 
that's instead of your first echo line by the way.

Andrew
 
try just putting echo $sid; somewhere else in your coding... check it's being set correctly...

Andrew
 
I guarentee to you that this DOES work:

Code:
<?
$sid = 1;
 print ("<tr>\n"); 
      ?> <td><a href="handlecity.php?sid=<? echo $sid ?>&vcity=<? echo $Row["city"]; ?> ?>&vstate=<? echo $Row["state"]; 

?>"><? echo $Row["city"]; ?></a></td><br> 
      <td><a href="handlecounty.php?sid=<? echo $sid; ?>&vcounty=<? echo $Row["county"]; ?>&vstate=<? echo $Row["state"]; 

?>"><? echo $Row["county"] ?></a></td><br> <?
      print ("</tr>\n"); 
?>

I've tested it locally by declaring a load of variables... and it works... :)

Regards,
Andrew
 
quick explaination...

echoing lines encased in single quotes will not substitute $var-val pairs as the line isn't interpreted - php only interprets double quote encased lines...

$var = 'value';
echo "$var"; // ===> value
echo '$var'; // ===> $var
 
print ("<tr>\n");
echo ('<td><a href="handlecity.php?sid=$sid&vcity='.$Row['city'].'&vstate='.$Row['state'].'">'.$Row['city'].'</a></td>'."\n");
echo ('<td><a href="handlecounty.php?sid=$sid&vcounty='.$Row['county'].'&vstate='.$Row['state'].'">'.$Row['county'].'</a></td>'."\n");
print ("</tr>\n");


i thing this is match better :)

<?php
$Row[1]= "test";
$sid=1;
echo "<table><tr><td><a href=handlecity.php?sid=". $sid. "&vcity=" .$Row[1]. "&vstate=" .$Row[1].">".$Row[1]."</a></td></tr></table>";
?>

i use $row[1] for the Row['state'] etc

You don't need to write all this thing <?php echo etc ?>
One echo is enough :)
 
I know one echo is enough, I just find it easier to do that so I don't have to remember to change "" to '' etc, hehe

Andrew
 
print ("<tr>\n");
echo ('<td><a href="handlecity.php?sid=$sid&vcity='.$Row['city'].'&vstate='.$Row['state'].'">'.$Row['city'].'</a></td>'."\n");
echo ('<td><a href="handlecounty.php?sid=$sid&vcounty='.$Row['county'].'&vstate='.$Row['state'].'">'.$Row['county'].'</a></td>'."\n");
print ("</tr>\n");

here

Code:
print ("<tr>\n"); 
      echo ('<td><a href="handlecity.php?sid='.$sid.'&vcity='.$Row['city'].'&vstate='.$Row['state'].'">'.$Row['city'].'</a></td>'."\n"); 
      echo ('<td><a href="handlecounty.php?sid='.$sid.'&vcounty='.$Row['county'].'&vstate='.$Row['state'].'">'.$Row['county'].'</a></td>'."\n"); 
      print ("</tr>\n");

all I did was add '. before $sid and .' after
 
Back
Top