Solved

how I pass parameter in different document.form.action.value?

Posted on 2004-04-26
8
1,872 Views
Last Modified: 2007-12-19
FORM enctype="multipart/form-data" name="insertform" method="POST" action="newinsert.php" >
<INPUT type="hidden"  name=use_r  value="0">
Title: <INPUT type="text" name=title size="30">
Detail : <INPUT type="text" name=detail size="30">
<INPUT type="submit" value="submit">
<INPUT type="submit" value="submit1" onChange="this.forms.active.value=newupdate_book1.php">
<INPUT type="submit" value="submit2" onChange="this.forms.active.value=newupdate_img2.php"></FORM>

I want to go 3 pages and pass all parameter,too.
How I can change form.action
0
Comment
Question by:mika_ray
  • 3
  • 2
8 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 43 total points
ID: 10916595
If you want the same form to go to all three pages, it would be easier to do this:

<FORM enctype="multipart/form-data" name="insertform" method="POST" action="newinsert.php" onSubmit="document.hiddenform1.submit();document.hiddenform2.submit();">
<INPUT type="hidden"  name=use_r  value="0">
Title: <INPUT type="text" name=title size="30" onChange="hiddenform1.title.value=this.value;hiddenform2.title.value=this.value;">
Detail : <INPUT type="text" name=detail size="30" onChange="hiddenform1.detail.value=this.value;hiddenform2.detail.value=this.value;">
<INPUT type="submit" value="submit"></FORM>

<form enctype="multipart/form-data" name="hiddenform1" method="post" action="newupdate_book1.php" style="display:none;">
<INPUT type="hidden"  name=use_r  value="0">
<input type="text" name=title style="display:none">
<input type="text" name=detail style="display:none">
</form>

<form enctype="multipart/form-data" name="hiddenform2" method="post" action="newupdate_img2.php" style="display:none;">
<INPUT type="hidden"  name=use_r  value="0">
<input type="text" name=title style="display:none">
<input type="text" name=detail style="display:none">
</form>

You may have to change the order a bit to determine which one is submitted last, but overall, this code should work.

--Zyloch
0
 
LVL 63

Assisted Solution

by:Zvonko
Zvonko earned 41 total points
ID: 10916684
Like this:

<FORM enctype="multipart/form-data" name="insertform" method="POST" action="newinsert.php" >
<INPUT type="hidden"  name=use_r  value="0">
Title: <INPUT type="text" name=title size="30">
Detail : <INPUT type="text" name=detail size="30">
<INPUT type="submit" value="submit">
<INPUT type="submit" value="submit1" onClick="this.form.action='newupdate_book1.php';">
<INPUT type="submit" value="submit2" onClick="this.form.action='newupdate_img2.php';"></FORM>


0
 
LVL 36

Expert Comment

by:Zyloch
ID: 10916715
The one problem with the three submit buttons is that they will not all submit until all three are clicked. Because they are type submit, if you CLICK one of the last two, the form should submit to two places, however, if you click the first one, the form will only go to newinsert.php and no matter which one you click on the last two, one will be left over.

--Zyloch
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 30

Assisted Solution

by:third
third earned 41 total points
ID: 10916802

<script>
  function submitForm(obj){
   if(obj.value=='submit1'){
     obj.form.action = 'newupdate_book1.php';
   }
   else if(obj.value=='submit2'){
     obj.form.action = 'newupdate_img2.php';
   }
   obj.form.submit();
  }
</script>

<FORM enctype="multipart/form-data" name="insertform" method="POST" action="newinsert.php" >
<INPUT type="hidden"  name=use_r  value="0">
Title: <INPUT type="text" name=title size="30">
Detail : <INPUT type="text" name=detail size="30">
<INPUT type="button" value="submit">
<INPUT type="button" value="submit1" onclick="submitForm(this)">
<INPUT type="button" value="submit2" onclick="submitForm(this)">
</FORM>
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 10916869
Eh... This has the same problem as Zvonko's above, or am I missing something?

--Zyloch
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10916952
Zyloch, be so kind and stop spreading confusion.
Provide the solution for the assumption you did understood and wait for feedback from asker.
You are NOT the asker.

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Index on a Table 6 25
jquery datable hidden section doesn't submit 2 15
html Uncheck Checkbox 2 25
Responsive Font Size 6 29
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question