Page 1 of 1
Problem with form submission
Posted: Mon Oct 13, 2008 9:47 am
by tr33m4n
Hello there,
I need help. Basically I have a form approximately like the following:
Code: Select all
<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 php 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
Re: Problem with form submission
Posted: Mon Oct 13, 2008 11:45 am
by Blondy
as easy as going to hell
just rename the name for below codes(-----) to wrdpress defaults.
and also it's html not php
Code: Select all
<input type="text" name="-----" id="user_login" class="textarea" value="" size="20" tabindex="10" />
Code: Select all
<input type="password" name="-----" id="user_pass" class="textarea" value="" size="20" tabindex="20" />
if your problem is something else lz describe more
oh I forgot for location
change the ----- to your address
Re: Problem with form submission
Posted: Mon Oct 13, 2008 11:53 am
by tr33m4n
Thanks for the help, but im aware that to log into worpdress id have to do this. However the form has to submit itself to 2 different locations, which I can code myself, however one of the locations requires the 'user name' and 'password' fields to have a different 'name' value. Also the code at this location does not have open code, therefore I cannot edit the php to set a uniform name for the 2 fields.
If anyone can help that would be greatly appreciated, or if anyone knows how to change the php in how wordpress handles its logins so that I can set the username and password field' name from say 'log' and 'pwd' to 'username' and 'password' that would also be greatly appreciated.
Thanks again
Dan
Re: Problem with form submission
Posted: Mon Oct 13, 2008 2:10 pm
by omniuni
Try checking out the curl function.
http://us2.php.net/manual/en/function.curl-exec.php
I believe you can use that to submit post data.
-OmniUni
Re: Problem with form submission
Posted: Wed Oct 15, 2008 5:49 am
by Blondy
this one is easy too
but not sure about what telling you
try sendng all data to worldpress file
change values to what worldpress needs try including the other script in world press file & changing the script file values to world press one
sincerely
Sarah
Re: Problem with form submission
Posted: Wed Oct 15, 2008 11:31 am
by tr33m4n
Unfortunately I cannot do this either as the 'closed source' script is being hosted on a different server and I have no access to it, other than http, so I cant combine the scripts really. Thankyou for the reply however!
Cheers
Dan
Re: Problem with form submission
Posted: Thu Oct 16, 2008 10:51 am
by tr33m4n
Any other ideas? (shameless bump

)
Re: Problem with form submission
Posted: Sat Oct 18, 2008 12:25 pm
by Blondy
so you need to post data 1.to your host 2.another server is that right?
so if it's righ you should use java I just am not sure about the other server anyway if your interested tell me so I have some scripts if you can modify them
Re: Problem with form submission
Posted: Sun Oct 19, 2008 10:33 am
by tr33m4n
Thanks for your reply. Ah right, javascript might be the way forward then. Would I be able to send the data to 1 location and then rename the input fields to be sent to the other?
Cheers
Dan
Re: Problem with form submission
Posted: Mon Oct 20, 2008 11:52 am
by Blondy
here I found something interesting!
http://www.webmasterworld.com/forum88/5375.htm
and also the ajax code
for html head
Code: Select all
<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript">
function getScriptPage(div_id,status,more_options,act_id)
{
subject_id = div_id;
status = document.getElementById(status).value;
switch(more_options)
{
case '1':
{
http.open("GET", "script_page.php?val1=" + escape(content1)+"&val2=" + escape(content2)+"&val3=" + escape(content3), true);
}
break;
case '2':
{
http.open("GET", "script_page.php?delete=1&id=" + escape(act_id), true);
}
break;
case '3':
{
http.open("GET", "done.php?status=" + escape(status)+"&id=" + escape(act_id), true);
}
break;
}
http.onreadystatechange = handleHttpResponse;
http.send(null);
document.getElementById(content_id1).value ="";
document.getElementById(content_id2).value="";
document.getElementById(content_id3).value="";
}
function reset(content_id1,content_id2,content_id3)
{
document.getElementById(content_id1).value ="";
document.getElementById(content_id2).value="";
document.getElementById(content_id3).value="";
}
</script>
//hint case 1 is what you want and it sends data to one location with special values
there should be no problem if you add another line for somewhere else location too
and for form
Code: Select all
<div class="input-div">
<TABLE border="0" class="CommentsofT" cellspacing=0 width="200px" cellpadding="5">
<TR>
<TD colspan="2"><strong>???????</strong></TD>
</TR>
<TR>
<TD><strong>??? :</strong></TD>
<TD align="left" class="commenthelpHed"><INPUT TYPE="text" NAME="name" id="s"></TD>
</TR>
<TR>
<TD><strong>????? :</strong></TD>
<TD align="left" class="commenthelpHed"><INPUT TYPE="text" NAME="email" id="text_content2"></TD>
</TR>
<TR>
<TD><strong>????? :</strong></TD>
<TD align="left" class="commenthelpHed"><TEXTAREA NAME="comment" ROWS="4" COLS="30" id="text_content3"></TEXTAREA></TD>
</TR>
<TR>
<TD colspan="2" align="center" >
<INPUT TYPE="submit" value="?????" onMouseUp="getScriptPage('output_div','s','text_content2','text_content3','1','x')">
<INPUT TYPE="button" onClick="reset('text_content1','text_content2','text_content3')" value="Reset">
</TD>
</TR>
</TABLE>
</form>
</div>
sorry dude you change it the way you want it
the language inside is persian and also the ajax file is included, don't add any "<form ...."
if you're interested to use my and my friend code plz add or name as hint thanks
"Sarah Aria"
the ajax.js
Code: Select all
subject_id = '';
function handleHttpResponse() {
if (http.readyState == 4) {
if (subject_id != '') {
document.getElementById(subject_id).innerHTML = http.responseText;
}
}
}
function getHTTPObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object
Re: Problem with form submission
Posted: Thu Oct 23, 2008 3:44 pm
by Blondy
if you've got problems on this code let me now