dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
1839

inGearX
3.1415 9265
join:2000-06-11
New York

1 edit

inGearX

Member

same input field .. various submit ..

I made this simple trans.html (for my mobile phone)

I am thinking is there a way to have just ONE same text input .. And bellow have 4 submit option buttons ..
"en-id" , "id-en" ..

Is there a way to do it without javascript?

Thank you..

Forgot to put code
Its for this form that submits not to my .php but to google:

 
<form action="http://translate.google.com/m?hl=en&sl=en&tl=id&ie=UTF-8&prev=_m&q=goreng">
 
<input type="hidden" name="hl" value="en"/>
 
<input type="hidden" name="sl" value="en"/>
 
<input type="hidden" name="tl" value="id"/>
 
<input type="hidden" name="ie" value="UTF-8"/>
 
<input type="hidden" name="prev" value="_m"/>
 
<input type="text" name="q" style="width:65%" maxlength="2048" value=""/>
 
<input type="submit" value="en-id"/>
 
</form>
 
<form action="http://translate.google.com/m?hl=en&sl=id&tl=en&ie=UTF-8&prev=_m&q=goreng">
 
<input type="hidden" name="hl" value="en"/>
 
<input type="hidden" name="sl" value="id"/>
 
<input type="hidden" name="tl" value="en"/>
 
<input type="hidden" name="ie" value="UTF-8"/>
 
<input type="hidden" name="prev" value="_m"/>
 
<input type="text" name="q" style="width:65%" maxlength="2048" value=""/>
 
<input type="submit" value="id-en"/>
 
</form>
 
<form action="http://translate.google.com/m?hl=en&sl=en&tl=ru&ie=UTF-8&prev=_m&q=goreng">
 
<input type="hidden" name="hl" value="en"/>
 
<input type="hidden" name="sl" value="en"/>
 
<input type="hidden" name="tl" value="ru"/>
 
<input type="hidden" name="ie" value="UTF-8"/>
 
<input type="hidden" name="prev" value="_m"/>
 
<input type="text" name="q" style="width:65%" maxlength="2048" value=""/>
 
<input type="submit" value="en-ru"/>
 
</form>
 
<form action="http://translate.google.com/m?hl=en&sl=ru&tl=en&ie=UTF-8&prev=_m&q=goreng">
 
<input type="hidden" name="hl" value="en"/>
 
<input type="hidden" name="sl" value="ru"/>
 
<input type="hidden" name="tl" value="en"/>
 
<input type="hidden" name="ie" value="UTF-8"/>
 
<input type="hidden" name="prev" value="_m"/>
 
<input type="text" name="q" style="width:65%" maxlength="2048" value=""/>
 
<input type="submit" value="ru-en"/>
 
</form>
 

stray
join:2000-01-16
Warren, NJ

stray

Member

First the form:

<html>
  <head>
    <title>Multiple Submit buttons in PHP</title>
  </head>
  <body>
    <form action="multiple_submit.php" method="post">
      <input name="btn_submit" value="Button 1" type="submit" />
      <input name="btn_submit" value="Button 2" type="submit" />
      <input name="btn_submit" value="Button 3" type="submit" />
    </form>
  </body>
</html>
 

Then the PHP file receiving the POST: multiple_submit.php

As you can see the POST passes the name/value pair: btn_submit / Button X

<?php
switch ($_REQUEST['btn_submit'])  {
  case "Button 1":
    print "You pressed Button 1";
    break;
  case "Button 2":
    print "You pressed Button 2";
    break;
  case "Button 3":
    print "You pressed Button 3";
    break;
}
?>
 
 

Older versions of IE will mess up if you try to submit with the enter key, but with your phone I don't think that's a problem.

inGearX
3.1415 9265
join:2000-06-11
New York

inGearX

Member

Forgot to mention
Its for this form that submits not to my .php but to google:

 
<form action="http://translate.google.com/m?hl=en&sl=en&tl=id&ie=UTF-8&prev=_m&q=goreng">
 
<input type="hidden" name="hl" value="en"/>
 
<input type="hidden" name="sl" value="en"/>
 
<input type="hidden" name="tl" value="id"/>
 
<input type="hidden" name="ie" value="UTF-8"/>
 
<input type="hidden" name="prev" value="_m"/>
 
<input type="text" name="q" style="width:65%" maxlength="2048" value=""/>
 
<input type="submit" value="en-id"/>
 
</form>
 
<form action="http://translate.google.com/m?hl=en&sl=id&tl=en&ie=UTF-8&prev=_m&q=goreng">
 
<input type="hidden" name="hl" value="en"/>
 
<input type="hidden" name="sl" value="id"/>
 
<input type="hidden" name="tl" value="en"/>
 
<input type="hidden" name="ie" value="UTF-8"/>
 
<input type="hidden" name="prev" value="_m"/>
 
<input type="text" name="q" style="width:65%" maxlength="2048" value=""/>
 
<input type="submit" value="id-en"/>
 
</form>
 
<form action="http://translate.google.com/m?hl=en&sl=en&tl=ru&ie=UTF-8&prev=_m&q=goreng">
 
<input type="hidden" name="hl" value="en"/>
 
<input type="hidden" name="sl" value="en"/>
 
<input type="hidden" name="tl" value="ru"/>
 
<input type="hidden" name="ie" value="UTF-8"/>
 
<input type="hidden" name="prev" value="_m"/>
 
<input type="text" name="q" style="width:65%" maxlength="2048" value=""/>
 
<input type="submit" value="en-ru"/>
 
</form>
 
<form action="http://translate.google.com/m?hl=en&sl=ru&tl=en&ie=UTF-8&prev=_m&q=goreng">
 
<input type="hidden" name="hl" value="en"/>
 
<input type="hidden" name="sl" value="ru"/>
 
<input type="hidden" name="tl" value="en"/>
 
<input type="hidden" name="ie" value="UTF-8"/>
 
<input type="hidden" name="prev" value="_m"/>
 
<input type="text" name="q" style="width:65%" maxlength="2048" value=""/>
 
<input type="submit" value="ru-en"/>
 
</form>
 

But I wanna save space and have just ONE input field .. And no javascript .. It makes it a bit slower

GILXA1226
MVM
join:2000-12-29
Dayton, OH

GILXA1226

MVM

Doesn't seem possible without some sort of logic processing to get you submitting to the correct URL with the proper options. This is going to require more than just markup.

cowboyro
Premium Member
join:2000-10-11
CT

cowboyro to inGearX

Premium Member

to inGearX
Why without javascript? Even the dumbest phones with a web browser can do javascript...

Toad
join:2001-07-22
Bradford, ON

Toad to inGearX

Member

to inGearX
Not sure why you have the hidden inputs in addition to the same parameter specified in the action of the form.

Could you not do this in one form with drop downs for tl and sl? The rest of the hidden inputs remain the same.