Jump to content

Archived

This topic is now archived and is closed to further replies.

phpme1221

passing array in url

Recommended Posts

Hi aykay,  doesn't it appear as 1 form in the code after the foreach but in the browser it contains possibily multiple forms, so how to i submit once? thanks

Share this post


Link to post
Share on other sites

you will need JavaScript, i posted a useful link in one of my previous posts

Share this post


Link to post
Share on other sites

Thanks aykay for getting back to me, but the function knows the # of forms to submit?  just dont kow enough fo js to do it. 

Share this post


Link to post
Share on other sites

what that function does is, when called, submits the 3 forms that are specified in the function scope..

 

function submitForms() 
{ 
this.document.form1.submit(); 
this.document.form2.submit(); 
this.document.form3.submit(); 
} 

 

you would replace, form1, form2, form3 with the names of your forms...

so if you had a form like so..

<form name="test_form" action="#" >

the function would be

function submitForms() 
{ 
document.test_form.submit();  // add as many as you want really
}

then you can make a button that will call the function to submit all of the forms..

<button onlclick="submitForms()">Submit</button>

 

Share this post


Link to post
Share on other sites

Hi Aykay,

 

Thanks again, again we dont know # of forms this will generate, a user can have 1 server to register or 10 server to register.  Whats really confusing in the after th foreach;  there is only 1 <form tag so there is only 1 name but if you run the function you mention in you last poist there are 3 different form names to consider but i have only 1, even though it appears as more depending on amount a servers onwned by the user passed in the url

 

 

Share this post


Link to post
Share on other sites

so in the function something to increment the form name using count , like name=form1 name=form2 but how do you code that ?

Share this post


Link to post
Share on other sites

i saw this, will something like this work?

 

count=0

while(document.forms[count]){

document.forms[count].submit()

count++

}

Share this post


Link to post
Share on other sites

i saw this, will something like this work?

 

count=0

while(document.forms[count]){

document.forms[count].submit()

count++

}

this code should cycle through your forms and submit each yes

Share this post


Link to post
Share on other sites

Thanks aykay, what should be in the form, so that the js code can use to reference?  keep in mind this is an unknown array of servers. thanks 

<form name = ? or value = ?

<input type='submit' name='entdb' value='Register' >

</form>";

 

should it be a type = submit or type = button ?

Share this post


Link to post
Share on other sites

thanks aykay, should i follow example 2

 

#2:

"function submitAllDocumentForms()"

- Submit all forms in document

 

?

Share this post


Link to post
Share on other sites

if those forms are the only ones that you are planning on having on the page, then yes follow example #2

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.