Passing of Value through URL and getting it through $_GET fails
<p>I'm a PHP newbie, so please be considerate.</p>

<p>I'm trying to pass the doc_id (in the codes below) through the url to another page. Unfortunately, what shows up in the address bar when I click this link, is doc_id=  </p>

<pre><code>echo'&lt;td&gt;&lt;a href="view_profile.php?doc_id='.$row[doc_id].'" onclick="return confirm(\'Do you wish to view this record?\');"&gt;View Profile&lt;/a&gt;&lt;/td&gt;';
</code></pre>

<p>This link actually works on other pages. I can't figure why it won't work on the one I'm using it on right now. Any ideas?</p>

<p>Any suggestions will be greatly appreciated.</p>

<p>that line is from this:</p>

<pre><code>if($SearchBySpec) { $query="SELECT * FROM doctor where specialization='$SearchBySpec'"; $result=mysql_query($query) or die('Error executing select query'.mysql_error());



echo'&lt;table border="1" cellspacing="1"&gt;'; echo'&lt;tr align="center"&gt;'; echo'&lt;td bgcolor=#81F7D8 width="80" class="auto-style2"&gt;&lt;strong&gt;Specialization&lt;/strong&gt;&lt;/td&gt;'; echo'&lt;td bgcolor=#81F7D8 width="80" class="auto-style2"&gt;&lt;strong&gt;Last Name&lt;/strong&gt;&lt;/td&gt;'; echo'&lt;td bgcolor=#81F7D8 class="auto-style2" style="width: 103px"&gt;&lt;strong&gt;First Name&lt;/strong&gt;&lt;/td&gt;'; echo'&lt;td bgcolor=#81F7D8 width="80" class="auto-style2"&gt;&lt;strong&gt;Middle Initial&lt;/strong&gt;&lt;/td&gt;'; echo'&lt;td bgcolor=#81F7D8 width="90" class="auto-style2"&gt;&lt;strong&gt;School&lt;/strong&gt;&lt;/td&gt;'; echo'&lt;td bgcolor=#81F7D8 width="80" class="auto-style2"&gt;&lt;strong&gt;Hospital Assigned&lt;/strong&gt;&lt;/td&gt;';

while($row=mysql_fetch_array($result)) { echo "&lt;tr align=center&gt;"; echo "&lt;td&gt;$row[specialization]"; echo "&lt;td&gt;$row[last_name]"; echo "&lt;td&gt;$row[first_name]"; echo "&lt;td&gt;$row[middle_name]"; echo "&lt;td&gt;$row[school]"; echo "&lt;td&gt;$row[hospital_assigned]";

}

//echo"&lt;td&gt;&lt;a href='view_profile.php?doc_id=".$row[doc_id]."'&gt;View Profile&lt;/a&gt;&lt;/td&gt;";    echo'&lt;td&gt;&lt;a href="view_profile.php?doc_id='.$row[doc_id].'" onclick="return confirm(\'Do you wish to view this record?\');"&gt;View Profile&lt;/a&gt;&lt;/td&gt;'; //echo'&lt;td&gt;&lt;a href="view_profile.php?doc_id='.$row[doc_id].'" onclick="return confirm(\'Do you wish to view this record?\');"&gt;View Profile&lt;/a&gt;&lt;/td&gt;'; echo "&lt;tr&gt;&lt;td&gt;There are ". mysql_num_rows($result). " record(s)found.&lt;/td&gt;&lt;/tr&gt;"; echo "&lt;/table&gt;"    ;

}
</code></pre>
