Solved

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

Posted on 2004-04-26
8
1,870 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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 …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

808 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