Quick PHP Form Help Needed

gimme4free

Elite Member
Joined
Oct 22, 2008
Messages
1,935
Reaction score
1,989
I'm stuck on my laptop at the moment while I reinstall Windows on my PC (Gave up trying to fix it) and trying to make a form.

The form is in java/PHP.

I need the user to select a value from a dropdown list and then I also need a copy and paste box beneath it, such as:

Select From List:
(Options: Google, MSN, Live)

Text Box:
(http://<? echo "$option" ?>)

And then depending on what they select in the first box it will change. I don't want the user to have to submit the form before the change, so it's like an on-the-go form where whatever they select and it comes up.

Anyone got a similar form they can copy/paste here for me please? :)
 
Simple HTML+jQuery.
To make it work you have to download jQuery lib from :http://jquery.com/

HTML:
<html>
<head>
		<script type="text/javascript" src="jquery.js"></script>
</head>
<body>

	<script type="text/javascript">
	var message = new Array();
	message[1] = "http://gogle.com";
	message[2] = "http://amazon.com";
	message[3] = "http://ebay.com";
	
	$(document).ready(function(){			
		$("#item_select").change(function()
		{
			var message_index
			
			message_index = $("#item_select").val();
			
			if (message_index > 0)
				$('#test').val(message[message_index]);
		});
	});
	</script>
	
	
	<select id="item_select">
		<option>Select an Item</option>
		<option value="1">google</option>
		<option value="2">amazon</option>
		<option value="3">ebay</option>
	</select>

<input id="test" type="text">	

</body>
</html>

If you need more help shot me msg on e-mail (you know the address:) )

Regards
Cyklotrial (Lukas)
 
Back
Top