Solved

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

Posted on 2004-04-26
8
1,884 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

717 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