/    Sign up×
Community /Pin to ProfileBookmark

PHP auto submit?

Hi every one heres what i got:
a form that handels a login for my web site but i want to be able to auto subit is as soon as the page loads or it just sumits the post (form data in another way) in other words the form submits automaticly instead of pressing submit.
any help would be apreciated,
thanks,

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@felgallJun 24.2006 — Javascript would be the only language that could handle that for you.
Copy linkTweet thisAlerts:
@bokehJun 24.2006 — Why would a login form need such a feature? Why would you send someone a form and then submit it before they had a chance to enter any data. Sounds fishy to me!
Copy linkTweet thisAlerts:
@drhart4000authorJun 24.2006 — i have a web site with email forwarding and free ""gmail"". i own the domain cateyepro.com, and to host with godaddy and and pay for email adds up to be a bit mutch. so i decided to work with gmail. so i have an account named [email][email protected][/email] and this forwards to [email][email protected][/email] but on my website i want to be able to login with webmaster instade of webmaster.cateyepro on my webpage. (i have a gmail login section on my site) so i maid a way of processing the login at my site. now i just need to do the login to gmail. so i figured the best way would to make another gmail login and store the username and passwd and autosubmit it. but i cant figure out how to do this. I dont really know javascript i'd like to doit in php but if any one can show me how to do this in any coding id be very greatfull

Thanks,
Copy linkTweet thisAlerts:
@felgallJun 24.2006 — Events are handled by the browser so you can't do it server side unless you first manually submit the form to request server side processing.

To autosubmit the first form on the page when the page finishes loading add the following to the head of the page.

<script.type="text/javascript">
function init() {
document.forms[0].submit();
}
window.onload = init;
</script>
Copy linkTweet thisAlerts:
@bokehJun 24.2006 — onload waits for the whole document to load (including images) before applying any Javascript. If you place the following right after your form the document will not have to be fully loaded.[code=php]<script type="text/javascript">document.forms[0].submit();</script>[/code]
Copy linkTweet thisAlerts:
@SheldonJun 25.2006 — Rather than an auto submit which does sound a "different" way to do it.

Why dont you just log in wiht webmaster and add the other credentials in to your post data?

[code=php]
$username = $_POST['username']; //webamaster
$username = $username . "[email protected]";
//[email protected]

if($username = "gmailuser"){ // good
//run gmail login
}else{
//bad
}
[/code]
Copy linkTweet thisAlerts:
@drhart4000authorJun 25.2006 — Rather than an auto submit which does sound a "different" way to do it.

Why dont you just log in wiht webmaster and add the other credentials in to your post data?

[code=php]
$username = $_POST['username']; //webamaster
$username = $username . "[email protected]";
//[email protected]

if($username = "gmailuser"){ // good
//run gmail login
}else{
//bad
}
[/code]
[/QUOTE]

thats exactly what i was trying to do at first but i could not figure it out.

Thankyou all for your help
Copy linkTweet thisAlerts:
@drhart4000authorJun 25.2006 — this is great but know i need to know just how to intergrate this with my gmail login.

here is my gmail login script:
[code=html]<!-- ServiceLoginElements.nui=logo --> <div style="background:#E8EEFA" id="gaia_loginbox" class="body">
<form action="https://www.google.com/accounts/ServiceLoginAuth" onsubmit="return(gaia_onLoginSubmit());" name="login" id="gaia_loginform" method="post"> <input type="hidden" name="ltmpl" value="yj_wsad"> <input type="hidden" name="ltmplcache" value="2">
<table cellpadding="1" cellspacing="0" align="center" border="0" id="gaia_table"> <!-- LoginBoxLogoText.quaddamage=VERSION1 -->
<tr> <td colspan="2" align="center"> <font size="-1"> Sign in to Gmail with your </font> <!-- LoginBoxGoogleAccountLogo.retro=false -->
<table> <tr> <td valign="top"> <img src="https://www.google.com/accounts/google_transparent.gif" alt="Google"> </td> <td valign="middle"> <font size="+0"><b>Account</b></font>
</td> </tr> </table> </td> </tr> <tr> <td colspan="2" align="center">
<div class="errorbox-good"> </div> </td> </tr> <tr> <td nowrap> <div align="right"> <span class="gaia le lbl"> Username: </span> </div> </td> <td> <input type="hidden" name="continue" value="http://mail.google.com/mail/?ui=html&amp;zy=l">
<input type="hidden" name="service" value="mail">
<input type="hidden" name="rm" value="false">
<input type="hidden" name="ltmpl" value="yj_wsad">
<input type="text" name="Email" value="" class="gaia le val" id="Email" size="18"> </td> </tr> <tr> <td></td> <td align="left">
</td> </tr> <tr> <td align="right"> <span class="gaia le lbl"> Password: </span> </td> <td>
<input type="password" name="Passwd" Value="" class="gaia le val" id="Passwd" size="18"> </td> </tr> <tr> <td></td> <td align="left"> </td> </tr> <tr> <td align="right" valign="top"> <input type="checkbox" name="PersistentCookie" value="yes">&nbsp;
<input type="hidden" name="rmShown" value="1"> </td> <td> <span class="gaia le rem"> Remember me on this computer.
</span> </td> </tr> <!-- LoginElementsSubmitButton.nui=default --> <tr> <td></td> <td align="left"> <input type="submit" name="null" value="Sign in" class="gaia le button"> </td> </tr> <tr id="ga-fprow">
<td colspan="2" align="center" height="33.0" valign="bottom" nowrap class="gaia le fpwd"> <a href="https://www.google.com/accounts/ForgotPasswd?continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&amp;service=mail" target="_top"> Forgot your username or password? </a> </td> </tr> </table> </form> </div>[/code]
×

Success!

Help @drhart4000 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...