Solved

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

Posted on 2004-04-26
8
1,864 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now