Hi,
I'm pretty new to php and I've searched the forums for this but haven't found the answer. My problem is that I'm trying to pass a variable to another form where the variable is deprived from a select statement, and this variable is in an echo statement because I only want to show the link if the results of my query returns null values. Here are some parts of it:
<?php
$sql = "SELECT property.property_id,
property.address,
property.city,
agent.agent_id,
agent.name
FROM activity
LEFT OUTER JOIN agent ON (agent.agent_id = activity.agent_id)
JOIN property ON (property.property_id = activity.property_id)
ORDER BY property.address
";
$result = mysql_query($sql)
or die("Invalid query: " . mysql_error());
while( $row = mysql_fetch_array($result, MYSQL_ASSOC) ){
?>
<?php
if (is_null($row['agent_id']))
echo "<a href="agent.php?id=<?php $row['property_id']?>">[Add Agent]</a>";
?>
Is there another way to do this? I've tried setting the $row['property_id'] to a variable, then calling it in the url, but somehow it converts the url as it is, literally. For example, the variable I set was $v1=$row['property_id'], then calling it in the url: echo "<a href="agent.php?id=<?php $v1?>">[Add Agent]</a>"; but the link would show: '...com/agent.php&id=$v1.
Is there another way to do this? Please help!
Thank you.