Help - Search - Members - Calendar
Full Version: One Form, Two Buttons = Two Diffrent Actions?
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
lambokid
Thanks for your time

I want one text box, with two buttons too perform two different actions.
When i press one button i want it to search the site, and the other button to search google

Here is a visual of what i want.
IPB Image

This is what i have now.....

CODE
    <form action="search.php" method="post">
      <input class="search" onblur="if (value==''){value='Search DDLoogle';}"  onfocus="if (value == 'Search DDLoogle') {value='';}" size="60" type="text"
          name="q" />
      <br><input class="button" type="submit" value=     "DDLoogle Search"      name="submit" size="12" />
    </form>
Darin McGrew
Please see the FAQ entry Can I have two or more Submit buttons in the same form?
lambokid
okay i tried naming each button,
i searched google for a while, and 90% of the results says exactly that

but i dont understand what the naming accomplishes.
how is the names suppose to choose which action i want the form to perform?

well i pulled something out of my ___ , this obviously does not work...fully.
it automatically performs the first form action, whichever button i click


CODE
    

<form action="search.php" method="post" name="ddloogle">
<form action="http://www.google.com/custom" method="post" name="google">
      

<input class="search" size="60" type="text" name="q" />

<input type="submit" value="DDLoogle Search" name="ddloogle" />
<input type="submit"  value="Google Search" name="google" />

</form>

Example: (www.ddloogle.com/index2.php)



im juts guessing this is impossible, because i also find on google, that a form with two actions is impossible..blahblahblah
does anyone know anyway of helping me... i dont mind using another programming language, just name it..
Darin McGrew
You need a single server-side program that processes the form data and decides what to do based on which submit button was used.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.