Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Need help with form
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Need help with form

qwerty6666qwerty6666 Member
edited June 2012 in Help

Hi

I own some proxy website and i want to add some more server location . Last month i had another webmaster that was using my proxy surf ressourse using his hompage with a simple form code it gave me some idea of way to add more server location choice with the same site but i cant get it to work .

Heres a screenshot of what i want it to look like and the code of the other guys used

!(http://i2.lulzimg.com/0884aacb65.jpg)

So any idea to make it when a user enter url and press flag than the url is submitted using "post" to the process.php on the right server ?

Hope you guys have some nice idea to help me and try to make it look nice now it only give me Headache =D

Comments

  • vedranvedran Veteran
    <form name="form" method="post">
    <input type="text" name="url" />
    <input type="image" src="at.png" value="at" onclick="submitForm(this.value)" />
    <input type="image" src="be.png" value="be" onclick="submitForm(this.value)" />
    </form>
    
    <script>
    function submitForm(value) {
      document.form.action ='http://' + value + '.siteurl.com/process.php?action=update';
      document.form.submit();
    }
    </script>
    

    Something like that perhaps

  • KuroKuro Member

    something like this maybe? http://pastebin.com/S2zfeKiq

    Thanked by 1qwerty6666
  • joepie91joepie91 Member, Patron Provider
    edited June 2012

    It would be cleaner to have various 'submit buttons' (with flags on them?) depending on locations, and just set a different value for each submit button. Something along these lines:

    <form method="post" action="proxy.php">
        <input type="text" name="url" value="http://">
        <button type="submit" name="submit" value="nl"><img src="nl.png"> Netherlands</button>
        <button type="submit" name="submit" value="de"><img src="de.png"> Germany</button>
        <button type="submit" name="submit" value="fr"><img src="fr.png"> France</button>
    </form>

    All requests are initially sent to proxy.php. You could then make proxy.php throw a HTTP 301 redirect based on the value of $_POST['submit'] (which will hold the value attribute of the specific submit button that was clicked), pointing to the correct server.

    The above solution would not require Javascript, like vedran's solution would.

    EDIT: Wow, apparently text inside a <pre> tag is not treated as code.

    EDIT2:

    @Kuro said: something like this maybe? http://pastebin.com/S2zfeKiq

    I would not recommend using that. It makes no sense to set document variables, and is generally a messy way of doing it.

Sign In or Register to comment.