PDA

View Full Version : contract a form into a single hyperlink



w0296094
November 9th, 2010, 10:11 PM
Hey guys this is what i want to do:

I want to have a word that also acts like a hyperlink, or more specifically, acts as a form category that has already been selected. I.e.:

"You can select your non-profit by TYPE, ORGANIZATION, or FACULTY. "

any of the words that have been underlined will be clicked on and each word will execute a command:



<form action="viewdatabaseinformation.php" method="post">
<br />
<select name="searchtype">
<option value="TYPE">Type</option>
</select>
<br />
<input type="submit" value="Search">


In other words, as I click TYPE, it will be as if I selected type from a drop-down form and clicked submit. Is there anyway I can do this with PHP alone.

(I will be using PHP and mysql, using apache)

SeijiSensei
November 9th, 2010, 10:16 PM
Use an A tag and enter the parameter like this:


<a href='viewdatabaseinformation.php?searchtype=TYPE'>TYPE</a>

You can retrieve the value in PHP using either $_GET['searchtype'] or $_REQUEST['searchtype'].

w0296094
November 23rd, 2010, 09:19 PM
thanks, i understand the rationale behind it. Now i wanted to do a more complex one.



<form action="tbn.php" method="post">
View Service-Learning opportunities by selecting the organization below.
You may also sort opportunities and view them by faculty, location and type. : <br />
<select name="searchtype">
<option value="course">Department</option>
</select>
<br />
Enter Search Term: <br />
<input name="searchterm" type="text">
<input type="submit" value="Search">
</form>



Now the first part is the same, but how do i do it when i have to enter an additional filter(or filters) such as searchterm.