Solved

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

Posted on 2004-04-26
8
1,878 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP Web Development 6 67
Jquery Ajax - on change event not being picked up 9 60
REST call Failing 1 39
Global version website variable for clearing cache 10 29
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

732 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