Jump to content

Adding a word or variable to a link?


Recommended Posts

I have a search page, that you enter a name, and it searches the DB for that name. If there are results, they are displayed. If there are no results, it tells you that your search for "whatever" came back with zero results, and adds a hyperlink to that line. The hyperlink takes you to a form where you can add a new entry, but what i want, is for the word they searched for, to be carried to the addcontactform.php, so i can place it in the name field automatically.

if ($numrows == 0)  {  echo "<tr><td width='100%' bgcolor='CCCCCC' colspan='4'><font face='Arial, Helvetica, sans-serif'>Sorry, your search: "" . $trimmed . "" returned zero results <a href=\"addContactForm.php\">( Add a new contact )</a></font></td></tr>";  }

Is there a way to have the $trimmed variable attached to that hyperlink, like $_GET would do from a form, so the link would be like '../addContactForm.php?q=whatever'?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...