Execute Form post on page load

Hi All,

I am trying to submit a web form on page load but I can't get it to behave.

I have conditional PHP statement and if the condition is met then it loads this form with pre-filled field values.

I would like to at this point submit the form automatically. I have tried using the following javascript but it doesn't seem to be working.. does anyone have any ideas?

Thanks,

Rit
<script type="text/javascript"> 
    Window.onload = submitit;
	
	Function submitit() {
	document.getElemenById("co-shipping-method-form").submit();
	}
</script>

Open in new window

LVL 1
rito1Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Jonah11Connect With a Mentor Commented:
uncapitalize "Window" and "Function" and it should work.
0
 
sam2912Connect With a Mentor Commented:

<script type="text/javascript"> 
window.onload = submitit;
        
function submitit() {
   document.getElementById("co-shipping-method-form").submit();
}
</script>

Open in new window

0
 
rito1Author Commented:
Excellent, thanks.
0
All Courses

From novice to tech pro — start learning today.