Forms comprise of two parts. The actual form, and the processing Code
Here is my form
<form method="post" action="">
Please type something in here: <input type=text name="box" size="25" maxlength="50"> <br />
Do you use GGG?
<input type="radio" name="radio" value="use"> yes
<input type="radio" name="radio" value="dont use"> no <br />
Pick some of these, you choose!
<input type="checkbox" name="checkbox_1" value="1"> one
<input type="checkbox" name="checkbox_2" value="2"> two
<input type="checkbox" name="checkbox_3" value="3"> three <br />
Are you a...
<select name="listbox">
<option value="Fighter">Fighter</option>
<option value="Roleplayer">Roleplayer</option>
<option value="Fighter and roleplayer">Fighter and roleplayer</option>
</select>
<input type="submit" value="Submit!"/>
</form>
Here are some numerous examples of the differnt objects you can have on a form. points to note.
1. the "name" value will be sent to the MDscript as @input['name'] Where name is your name of your object
2. You can only select one choice with radio buttons
3. You can select more than one with a check box
And here is my Mdscript that "handles" the form
if(isset(@input['box'])) {
echo "you typed in " . @input['box'] . "<br />";
}
if(isset(@input['radio'])) {
echo "You said you " . @input['radio'] . " GGG <br />";
}
if(isset(@input['checkbox_1'])) {
echo "You selected Check box 1! <br />";
}
if(isset(@input['checkbox_2'])) {
echo "You selected Check box 2! <br />";
}
if(isset(@input['checkbox_3'])) {
echo "You selected Check box 3! <br />";
}
if(isset(@input['listbox'])) {
echo "You said you are a " . @input['listbox'] . " <br />";
}
echo @content['0'];
Here i have used the php function isset() to see if the variable is set.
if(isset(@input['textbox'])) { ... }
All this means is, Check if @input['textbox'] is set (someone typed something in) and if it is, do what is in the brackets. This will prevent all this code from being done when the user first loads up the page
Instead of just echoing the values you could make it more intresting by doing something with the values, like storeing the value as a variable in your quest. But! be careful, Just because someone can enter something, doesnt mean it will be something you nesscariy want to be entered. For example if you need a number to be entered, someone could enter a letter, and if your script doesnt check, it might break your script!
NOTE: This is PHP and i have no access to MDscript, So, if anyone wants to help me, please test the script.