0

i have a problem, i will send a POST with PHP but i will send a GET Parameter with the form value:

 <form action="/Eventsuche/" method="post">
            <table>
              <tr>
                <td>
                  <input id="Headsucheort" name="Headsucheort" type="text" value="" />
                </td>
                <td>
                  <button type="submit" name="Submit" id="Headsuchestart" value="Headsuchestart">»</button>
                </td> 
              </tr>

So, on submit he bring me to /Eventsuche/ but i would like to go here: /Eventsuche/Value of Headsucheort

Thanks! :)

  • Your question doesn't make much sense. It's like saying "I want to take an airplane by boat". They're two different methods. I don't know what you mean by "Send a GET parameter by POST". – Travesty3 Nov 22 '13 at 21:00
  • change `action`-attribute with javascript before submit. – u_mulder Nov 22 '13 at 21:00
  • then put get into method...?? – Black Sheep Nov 22 '13 at 21:00
  • Ah, I get it. You want to change the `action` attribute based on the value of `Headsucheort`. As @u_mulder says, change the `action` attribute with JS on submit. Take a look at [this answer](http://stackoverflow.com/a/10691688/259457) for a hint of how to change the action before submit. – Travesty3 Nov 22 '13 at 21:02

3 Answers3

1
<button onclick="window.location.href='/Eventsuche/' + document.getElementById('Headsucheort').value">»</button>

Didn't test but

Jompper
  • 1,412
  • 9
  • 15
0

If you really must do it in PHP, add this to Eventsuch:

if ( isset($_POST['Headsucheort']) ) {
    header('location:http://www.your-url.com/Eventsuche/'.$_POST['Headsucheort']);
    exit;
}
Dave
  • 3,658
  • 1
  • 16
  • 9
0

I see two ways to the that. first: you can add your variable to the end of your action value such as: action="Eventsuche?var=somevalue"

and second one would be: as a hidden input and even tho it is hidden, php will capture it on submit as in:

<input type="hidden" name="myvar_name" value="my_var_value" /> 

i think this should do it.

Justin
  • 172
  • 2
  • 15