Ok folks, here is the skinny. I am putting multiple links down that are dependent on the name of a licensee. I am trying to be able to submit the one clicked on and the page is submitted to itself.
PHP Code:
//create the text display area
<td colspan="9" rowspan="3" width="950">
//form that calls itself
<form name="calllink" action="<? $_SERVER['PHP_SELF']?>">
<?
//Automatically pulls the matching callsigns and places them in the Links field
$query = "SELECT Callsign FROM fcc WHERE LicenseeName = '" .
str_replace("\\'","\'",str_replace("'","\'",$row['LicenseeName'])) . "'";
$result2 = mysql_query($query);
//create the needed links in the Links area.
while($row2 = mysql_fetch_array($result2,MYSQL_NUM))
{
$output .= "<input type=hidden name=callsign><input type=button onclick=getlink(calllink, callsign, \"$row2[0]\") value=submit1>
<a href=javascript:getlink(calllink, callsign, \"$row2[0]\")>$row2[0]</a>" . ", ";
}
$output = substr($output,0,-2);
?>
//output all the text links in the links text area
<? echo str_replace("\\'","\'",str_replace("'","\'",$output)); ?>
//end of calllink form
</form>
//end of link text area
</td>
Header Script:
<script>
function getlink(form,name,link)
{
form.name.value=link;
form.submit();
}
</script>
As it stands, the links appear as they should, but when I click on the link, I get an error on page.
I am asking for any feedback on what I may be doing wrong. I am a total beginner with javascript and I am just trying to do this instead of buttons as it takes less space and maintains the form layout and style.
Any suggestions would be welcome and appreciated.
Thank you,
Cade
P.S. I have tried several different methods to accomplish my ends, but so far all are a failure. I am thinking that my javascript may be the culprit in this. Though at this time, it could be either the php or javascript.