?
Solved

reloading a form using php and including number of feilds depending on selection

Posted on 2003-03-12
7
Medium Priority
?
241 Views
Last Modified: 2008-03-03
i need to reload the page when a option is selected in a menu/list of a html form. i understand how to do the rest, its just getting it to reload when the selection is hit and passing a variable through the url

any ideas??

neil
0
Comment
Question by:neil109
  • 4
  • 3
7 Comments
 
LVL 6

Expert Comment

by:carchitect
ID: 8118975
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF">
<form method="post" action="">
  <select name="select" onChange="MM_goToURL('parent','gotosame.htm');return document.MM_returnValue">
    <option value="1" selected>Hi</option>
    <option value="2">Reload</option>
  </select>
</form>
</body>
</html>
0
 
LVL 6

Expert Comment

by:carchitect
ID: 8118978
or

<html>
<body>
<form method="post" action="">
  <select name="select" onChange="self.location.href('filename.htm')">
    <option value="1" selected>Hi</option>
    <option value="2">Reload</option>
  </select>
</form>
</body>
</html>
0
 

Author Comment

by:neil109
ID: 8119028
i need to parase the variable thats selected into php so if "html" was selected in the box then it would go to file.php?include=html how would i do that? just add the php into the java?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Accepted Solution

by:
carchitect earned 300 total points
ID: 8119079
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function move(str)
{
if(str=="1")
  self.location.href="file.php?include=html";
if(str=="2")
  self.location.href="file.php?include=php";
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF">
<form method="post" action="">
 <select name="select" onChange="move(this.value)">
   <option value="1" selected>HTML</option>
   <option value="2">PHP</option>
 </select>
</form>
</body>
</html>
0
 

Author Comment

by:neil109
ID: 8119107
cheers for that saved me hours of racking my brain
0
 
LVL 6

Expert Comment

by:carchitect
ID: 8119142
o thx we are here to share our knowledge
0
 

Author Comment

by:neil109
ID: 8119174
is there a way i can get it to pass all the rest of the form through onto the other page?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

569 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