THE EDIT BIO FORM
Now that you've added the SQL statements, you can now play with the form. This is done with HTML that has been embedded (meaning it's been mixed with) into the PHP.
Now, this is more or less where you have flexibility where you put the field. This works just like your regular form, except for a few minor differences.
Here's the table cell that holds the website field. Notice that any double quotes in the HTML have a \ slash in them. Also notice that the name and value is both set to the same name as the database field. This is what the script will use to pull as well as display the information already stored in the database.
-
<tr><td colspan=\"2\">"._WEBSITE.": <input type=\"text\" class=\"textbox=\" name=\"website\" value=\"".$user['website']."\" size=\"35\"/></td></tr>
Here's a checkbox, one of those items that will hold a yes or no answer:
-
<tr><td colspan=\"2\">"._BETANOTE." <input name=\"betareader\" type=\"checkbox\" class=\"checkbox\"".($user['betareader'] ? " checked" : "")."/></td></tr>
Radio buttons are a bit tougher, but not bad. (My Gender mod)
-
<tr><td colspan=\"2\">"._GENDER.":
-
<input type=\"radio\" class=\"radio\" value=\"2\" name=\"gender\" ".($user[gender] == 2 ? " checked" : "")."/> "._FEMALE."
-
<input type=\"radio\" class=\"radio\" value=\"1\" ".($user[gender] == 1 ? " checked" : "")." name=\"gender\"/> "._MALE."
-
<input type=\"radio\" class=\"radio\" value=\"0\" ".($user[gender] == 0 ? " checked" : "")." name=\"gender\"/> "._UNDISCLOSED."
-
</td></tr>
Radio button number 1 (Female) has a value of 2. If it's checked, put a 2 in the gender field in the database. If radio button number 2 (Male) is checked, put a number 1 in the gender field. Finally, if radio button number 3 (Undisclosed gender) is checked, put a 0 in the gender field.
If you want more options, simply add more in the same format.
Dropdown field is pretty much done in the same way, though there may be minor differences depending on your mod. Simply add options like you would any select form, making sure the name of the select array is the same as your field, and assign a number to each option. The value is the is the same as with the radio box, except instead of "checked" you'd write "selected."
Example: (JanAQs affiliation mod)
-
<tr><td colspan=\"2\">"._HOUSE." : <select NAME=\"house\">
-
<option ".($user[house] == 0 ? " selected" : "").">"._UNSORTED."</option>
-
<option ".($user[house] == 1 ? " selected" : "").">"._HUFFLEPUFF."</option>
-
<option ".($user[house] == 2 ? " selected" : "").">"._GRYFFINDOR."</option>
-
<option ".($user[house] == 3 ? " selected" : "").">"._RAVENCLAW."</option>
-
<option ".($user[house] == 4 ? " selected" : "").">"._SLYTHERIN."</option>
-
</select></td></tr>
If option #1, Unsorted, is selected a 0 will be written to the house field. If option #3 is selected, a 2 will be written to the house field and so on.
|
|

