Results 1 to 7 of 7

Thread: Problem with form submission

  1. #1
    Join Date
    Oct 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Problem with form submission

    Hello there,

    I need help. Basically I have a form approximately like the following:

    Code:
    <form name="loginform" id="loginform" action="action.php" method="post">
       <p>
          <label>Username<br /><br />
          <input type="text" name="log" id="user_login" class="textarea" value="" size="20" tabindex="10" /></label>
       </p>
       <p>
          <label>Password<br />
          <input type="password" name="pwd" id="user_pass" class="textarea" value="" size="20" tabindex="20" /></label>
     
       </p>
       <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> Remember Me</label></p>
       <p class="submit">
          <input type="submit" class="sendbutton" name="wp-submit" id="wp-submit" value="Log In" tabindex="100" />
          <input type="hidden" name="redirect_to" value="index.php" />
          <input type="hidden" name="testcookie" value="1" />
    </form>
    Which does its job perfectly well. However I need this form to submit the same variables entered into the password and username fields to a different location but with different input names. This is because one of the scripts that will process the login I cannot edit and has pre-determined names for the data to be submitted to... if that makes sense. The other script thats going to process this data is my wordpress blog. basically i want a login form that will log me into, say my hosting account and my blog. Im rather new when it comes to javascript and can usually get by, however this has stumped me. Or if anyone knows how to edit the wordpress login system to use the same form 'names' then that would be great also. Im sorry if im not making much sense :(

    Many thanks

    Dan

  2. #2
    Join Date
    Oct 2008
    Posts
    60
    Thanks
    2
    Thanked 7 Times in 7 Posts

    Default form to submit the same variables entered into the password and username fields

    Do you use PHP? Just to understand your question, when the user enters the username/password and clicks "log in", you want the username and password to carry over to the next page and autofill the inputs on that page?

  3. #3
    Join Date
    Oct 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation

    Hello, thankyou for your reply, and yes I do use PHP, however a friend said that this might be easier with javascript, im quite unfamiliar with it tho.

    In response to your reply no, thats not quite it. When the user inputs the information and presses submit the data is sent to 2 different php scripts to process the details and 'log in'. One script logs the user into wordpress, and the other script logs the user into their hosting account. However as the script to log into the hosting account is closed source, it will only accept the login if the username and password fields have the input name of 'username' and 'password' respectively. Wordpress will only allow login if the 'name's are set to 'log' and 'pwd'. I was wondering whether there was a way of sending the data to one script with 'log' and 'pwd' as the input field names, and then changing them to 'username' and 'password' with another script?

    Thanks again
    Dan

  4. #4
    Join Date
    Oct 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question

    Anybody?

  5. #5
    Join Date
    Nov 2007
    Location
    USA
    Posts
    170
    Thanks
    8
    Thanked 22 Times in 22 Posts

    Default

    You could try using hidden fields that automatically get filled with the correct data when it is submitted.

    Like try adding:

    Code:
    <input type="hidden" name="username" value="" />
    <input type="hidden" name="password" value="" />
    Then when you submit the form just grab the data from the inputs and put it into the values of the hidden fields.

    I don't know if this would work or not, but it's just a suggestion.
    What is obvious to you might not be to another.


    My Site

  6. The Following User Says Thank You to Moshambi For This Useful Post:

    tr33m4n (10-17-2008)

  7. #6
    Join Date
    Oct 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile

    Hey, cheers for that, that seems like the way to go about it. Any idea how id go about grabbing the data?

    Thanks again

    Dan

  8. #7
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    One form submission twice to two different locations can be solved with AJAX I think. You don't have to submit both through AJAX though.

    1. You can start the ajax call for submitting the form to the first location.

    2. After the first ajax call result in success you can submit the form to another location either using JS - document.forms['frm_name'].submit() or via ajax like the first one.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •