Change Action Dynamically

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aravona
Forum Contributor
Posts: 347
Joined: Sat Jun 13, 2009 3:59 pm
Location: England

Change Action Dynamically

Post by aravona »

I have a html form which I need to dynamically change the form action based on the drop down menu selection and I'm having difficulty with everything I've searched for on google.

Code: Select all

<?php
		$id1= 'select mID from ver_pro'
		if ($id1 == 1 || $id1 == 3 || $id1 == 4||){
		$id=24;
		}
		else if ($id1 == 2){
		$id=30
		}
		?>
<form id="frm24" name="frm24" action="index.php?cmd=$id" method="post" enctype="multipart/form-data">
		<select name="search">
		<option id="cues">Cues</option>
		<option id="other">Other</option>
		</select>
	  <input type="text" name="srch" value="Search" onfocus="this.value=(this.value=='Search') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'Search' : this.value;" style="height:14px; width:108px; border-left:2px solid #8C8A80; border-top:2px solid #8C8A80; border-right:2px solid #F8F7F0; border-bottom:2px solid #F8F7F0; padding:3px; color:#000000; background:#FFFFFF;" /><input type="image" src="images/go.jpg" align="absmiddle" width="30" height="28" alt="" border="0" />
	</form>
The issue is, I need to have 2 search pages, one cmd=24 and the other is cmd=30 (based on a switch I've got in my class-functions) the reasoning is the Cues page on the website has a different format to those of the normal items. I need to make sure that only cues show up on the Cues drop down menu page, and everything else on the other. All cues share the unique id of mID=2 (this is actually my menu id) And I'm having real problems with link the $id in based on the dropdown choice, I maybe doing it completely backwards even.

I would like someone to possibly guide me in the right direction, I'm not actually asking anyone to just do this for me as I know its got a fair few variables.

King Regards,

Aravona
aravona
Forum Contributor
Posts: 347
Joined: Sat Jun 13, 2009 3:59 pm
Location: England

Re: Change Action Dynamically

Post by aravona »

I'm going a different way now and I'm going to try a redirect page instead of trying to get the action to change based on the drop down ^_^
Post Reply