Forums
This topic is locked
auto submit form on page load
Posted 14 Jul 2006 06:50:47
1
has voted
14 Jul 2006 06:50:47 dennis brownlie posted:
DW8 / PHP / MySQLIs there a way to submit a form when the page is loaded? I have tried examples in this forum and been unable to solve my problem. I want to emulate a user entering the page and pressing the submit button.
Thanks
Replies
Replied 14 Jul 2006 10:40:52
14 Jul 2006 10:40:52 Roddy Dairion replied:
Don't u have to enter details in form fields????
Replied 14 Jul 2006 20:30:57
14 Jul 2006 20:30:57 dennis brownlie replied:
It was late and I was stuck on this method of solving the problem. Took a fresh approach this morning and all woks fine now
thanks
thanks
Replied 14 Jul 2006 20:31:50
14 Jul 2006 20:31:50 dennis brownlie replied:
It was late and I was stuck on this method of solving the problem. Took a fresh approach this morning and all woks fine now
thanks
thanks
Replied 22 Jul 2006 00:06:26
22 Jul 2006 00:06:26 Dan Berdusco replied:
Even though you have already figured this out a different way - submitting a form when the page loads is very simple and there are cases where this can be used (I have had to use this before). Simply add this to your body tag.
<pre id=code><font face=courier size=2 id=code><body onLoad="document.formName.submit()">
</font id=code></pre id=code>
<pre id=code><font face=courier size=2 id=code><body onLoad="document.formName.submit()">
</font id=code></pre id=code>
Replied 24 Jul 2006 11:43:55
24 Jul 2006 11:43:55 Roddy Dairion replied:
But if somefing needs to be posted from a form, so how can you post something that hasn't been entered?? I must be missing something.
Replied 24 Jul 2006 23:14:17
24 Jul 2006 23:14:17 Dan Berdusco replied:
One thing that I have used this method for in the past is submitting data to a database that has been stored in session variables or cookies. You place that data into a hidden form variable and submit it when the page loads.
Edited by - flexman44 on 25 Jul 2006 00:46:23
Edited by - flexman44 on 25 Jul 2006 00:46:23
Replied 25 Jul 2006 11:31:29
25 Jul 2006 11:31:29 Roddy Dairion replied:
Ok but doesn't it have to be entered somewhere 1st???
Replied 25 Jul 2006 16:55:30
25 Jul 2006 16:55:30 Dan Berdusco replied:
With a hidden form field (or any for field i guess) you can enter the default value. So, what i would do is set the default value of the hidden form field to the value of the variable that I had stored, and then submit it. You don't have to manually fill something out.
Replied 28 Nov 2006 19:54:35
28 Nov 2006 19:54:35 Juan Pablo replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Even though you have already figured this out a different way - submitting a form when the page loads is very simple and there are cases where this can be used (I have had to use this before). Simply add this to your body tag.
<pre id=code><font face=courier size=2 id=code><body onLoad="document.formName.submit()">
</font id=code></pre id=code>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
But the form is inside the body tag?
Thanks.
Even though you have already figured this out a different way - submitting a form when the page loads is very simple and there are cases where this can be used (I have had to use this before). Simply add this to your body tag.
<pre id=code><font face=courier size=2 id=code><body onLoad="document.formName.submit()">
</font id=code></pre id=code>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
But the form is inside the body tag?
Thanks.
Replied 28 Nov 2006 20:02:08
28 Nov 2006 20:02:08 Dan Berdusco replied:
Yes, the form would need to be located with the body tag. You will have to change the text "formName" in the javascript to match the name of the form you would like to be submitted when the page loads.
Replied 28 Nov 2006 22:54:33
28 Nov 2006 22:54:33 Juan Pablo replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Yes, the form would need to be located with the body tag. You will have to change the text "formName" in the javascript to match the name of the form you would like to be submitted when the page loads.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I use php code for that, and thanks that help a lot.
Yes, the form would need to be located with the body tag. You will have to change the text "formName" in the javascript to match the name of the form you would like to be submitted when the page loads.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I use php code for that, and thanks that help a lot.