I have been searching for a few days on how to do this and I have yet to find an example of what I am looking for. Am I looking for the wrong thing?
Here is what I am trying to accomplish using the following code, I am reading in my error code and creating a link out of the error code.
<p><h4>Errors Returned (if any): </h4>
<a href="https://www.mysite.com/test/search_form.php?query=<?php echo $ERRORCODE; ?>">
<?php echo $ERRORCODE; ?>
</a>
</p>
I am then posting this information to my search form (below):
<?php
if (isset($_GET['query']))
{
echo "javascript... and such.";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Search - Test Site 2013</title>
</head>
<table border="0" cellpadding="10">
<tr>
<td>
<img src="images/test.png">
</td>
<td>
<h1>Search - Test Site 2013</h1>
</td>
</tr>
</table>
<body>
<form action="search.php" method="GET" name="errorsearch">
Search by Error Code
<input type="text" name="query" />
<input type="submit" value="Search" name="search"/>
</form>
</body>
</html>
I am using (isset($_GET['query'])) to check if the error code has been passed over in the URL. I am able to successfully display a message or something silly, but I would like to submit the form and check for the error code text BUT ONLY IF query has been set.
It is my understanding that Javascript can do this but I am unsure exactly what is needed. I was researching Javascript submit buttons and on-click events but I think this is the opposite of what I want. I just need JS to initiate the button click.
Can someone point me in the right direction?