View Full Version : Problem with form submission

10-13-2008, 08:02 PM
Hello there,

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

<form name="loginform" id="loginform" action="action.php" method="post">
<label>Username<br /><br />
<input type="text" name="log" id="user_login" class="textarea" value="" size="20" tabindex="10" /></label>
<label>Password<br />
<input type="password" name="pwd" id="user_pass" class="textarea" value="" size="20" tabindex="20" /></label>

<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" />

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


10-13-2008, 09:18 PM
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?

10-14-2008, 12:04 AM
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

10-16-2008, 04:50 PM

10-16-2008, 05:14 PM
You could try using hidden fields that automatically get filled with the correct data when it is submitted.

Like try adding:

<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.

10-17-2008, 06:55 AM
Hey, cheers for that, that seems like the way to go about it. Any idea how id go about grabbing the data?

Thanks again


10-17-2008, 09:30 AM
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.