Jump to content

Recommended Posts

:'(

 

I'm completely stuck, HELP! This is pretty much the last thing I need to finish to get my business on the web.

 

I have an order form for my personalized children's book, however I need couple of fields that will come up in the form only if specific books are called. Is that something I can do with PHP?

Link to comment
https://forums.phpfreaks.com/topic/85438-form-input-help/
Share on other sites

That is Javascript...

 

<script language="javascript"> 
<!-- 
function setOptions(chosen) 
{ 
var selbox = document.myform.opttwo; 
selbox.options.length = 0; 
if (chosen == " ") { 
selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' '); 

} 
if (chosen == "1") { 
selbox.options[selbox.options.length] = new Option('first choice - option one','oneone'); 
selbox.options[selbox.options.length] = new Option('first choice - option two','onetwo'); 
} 
if (chosen == "2") { 
selbox.options[selbox.options.length] = new Option('second choice - option one','twoone'); 
selbox.options[selbox.options.length] = new Option('second choice - option two','twotwo'); 
} 
if (chosen == "3") { 
selbox.options[selbox.options.length] = new Option('third choice - option one','threeone'); 
selbox.options[selbox.options.length] = new Option('third choice - option two','threetwo'); 
} 
} 
--> 
</script> <form name="myform"><div align="center"> 
<select name="optone" size="1" 
onchange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value);"> 
<option value=" " selected="selected"> </option> 
<option value="1">First Choice</option> 
<option value="2">Second Choice</option> 
<option value="3">Third Choice</option> 
</select><br /> <br /> 
<select name="opttwo" size="1"> 
<option value=" " selected="selected">Please select one of the options above first</option> 
</select> 
<input type="button" name="go" value="Submit"> 
</div></form> 

Link to comment
https://forums.phpfreaks.com/topic/85438-form-input-help/#findComment-435931
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.