Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
including different files based on form select field
Old 07-28-2004, 02:02 AM including different files based on form select field
Junior Talker

Posts: 3
Trades: 0
I want to include a different file when the user selects an item from a select field (pulldown menu) in an HTML form, but without hitting the submit button. I guess it would be a psuedo submit? Do I have to use javascript?

ie: they drop down the menu and select 1. below the pulldown menu is now displayed file1.txt. etc.
minieye is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-28-2004, 02:44 AM
Junior Talker

Posts: 3
Trades: 0
I did some more research... looks like it's javascript. but I found different methods and I would just like to know what is the best way to do it. I was using macromedia dreamweaver just to look for a solution and they use onChange="MM_jumpMenu('parent',this,0)" and then have a value thing on the option tag that they make you set to a file, so I set it to my same PHP file the form is in. that didn't work. this other site says to do this:

HTML Code:
<script> 
function refreshstuff() 
{ 
   document.foo.foo2.value="changed"; 
   document.foo.submit(); 
} 
</script> 

<form name="foo"> 

<select name="foo3" onChange="refreshstuff();"> 
<option>...</option> 
... 
</select> 
<input type="hidden" name="foo2" value="unchanged"> 
<?php 
if($foo2 == "changed") 
{ 
} ?>
which is better? I couldn't get the macromedia version working so I opted for the second one.
minieye is offline
Reply With Quote
View Public Profile
 
Old 07-28-2004, 04:54 AM
Ultra Talker

Posts: 377
Trades: 0
uhh... try to do like this...

<select name="foo3" onchange="document.location='?content='+this.value ;">
<option value="page1">goto page1</option>
<option value="page1">goto page1</option>
</select>

<?include "$content.php"?>

$content is a php variable that contains name of page that should be included. on changing "selectbox" value script sends a name of a page to current page. php's command includes it...
hope it's clear
__________________
andrews_john

Please login or register to view this content. Registration is FREE
andrews_john is offline
Reply With Quote
View Public Profile Visit andrews_john's homepage!
 
Reply     « Reply to including different files based on form select field
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44872 seconds with 12 queries