(edit) FIRST OF ALL: Your PHP is unsafe: please take a couple minutes and read about SQL injection: How can I prevent SQL injection in PHP?
Since you need to POST your data to the script, a simple HREF won't do the job. However, you CAN:
Make another small, invisible form wrapper with an invisible text field with "giraffe" as default value, and make the submit as text
<form method="post" action="s.php?go" id="searchform">
<input class="search" type="hidden" name="heyworld" value="giraffee" />
<input class="button" type="submit" name="giraffee" value="Search" />
</form>
Now, for the actual HREF you have 2 options: CSS the button to make it identical to a link, or make it a link, which will submit the (hidden) form with form.submit()
Here's a link explaining this:
How to HTTP POST from a link without JS
(edit) If you want to do it with GET, you just switch the global you take your data from in the script(note that this is STILL UNSAFE CODE, but I haven't written PHP in a couple years so I better leave the tutoring to someone more qualified), and modify your HTML form to submit data by GET:
if(isset($_GET['submit']) && isset($_GET['go']) && preg_match("/^[ a-zA-Z0-9#@]+/", $_GET['msg']))
now your HREF can go to s.php?go&submit&msg=giraffee
- note that for the way your script is made noe, you need to send submit (empty string is ok, since you only check isset()
or something like that :)