Advanced php forms??

A

Anonymous

Guest
I want to create a form that when a yes or no option in a list element is selected the page automatically adds another option list next to with more options to pick.

This must work so that all of the cvalues entered previously into the form stay there.

In theory the form will refresh jsu tone part of the page introducing a new form element. I have seen this done on various other sites.

Thanks! :D :) :( :eek: :lol: 8) :? 8O :x :p :oops: :cry: :wink: :roll: :twisted: :evil: :!: :?: :idea: :arrow:
 
Show me where do you see the forms.
i don´t understand what you want to do. :?:
 
I believe that if you want things like that to happen when you click on an option in a <SELECT> list, you have to use some type of client side scripting, i.e. vbscript, javascript. If using vbscript, it would be the 'onClick' event, or possibly the 'onSelect' event for the Select form element.

I don't use client side scripting of any kind anymore, and if I was doing this, and wanted this type of behavior, instead of a <SELECT> dropdown, I would use either an array of submit buttons, each with a different choice, or a bunch of hyperlinks, one per choice, each one passing the value for that id in the query string.

When I want to retain the values of an in progress form, I grab all the post and get values, and store them in an array. When I'm displaying the form, each element is either blank, or has a value. something like this..

[/code]

if (isset($_POST['txt_user_name']))
{
$arr_form['txt_user_name'] = $_POST['txt_user_name'];
}
else
{
$arr_form['txt_user_name'] = "";
}

....

echo "<INPUT type = 'text' name = 'txt_user_name' value = '" ;
echo $arr_form['txt_user_name'];
echo "'>";


Code:
I hope that makes sense, and helps you a bit.
 
If you want to use client side scripting I suggest javascript, here you have a simple example:

Code:
<script language=""javascript>
function add(){
	document.all.my_p.innerHTML += "<input type='submit' value=send2>"
}
</script>
</HEAD>
<BODY>
<p id="my_p">
<input type="submit" onClick="add()" value="send1">
<p>
 
Back
Top