here my html form:
Code: Select all
<form action= "CreateChar.php" method="post">
<span class="style1">Character name:</span>
<input name="txtCharName" type="text" size="20" />
<br />
<br />
<span class="style1">Character Class:</span>
<select name="selCharClass">
<option value="Warrior" selected="selected">Warrior</option>
<option value="Mage" >Mage</option>
</select>
<br />
<br />
<input name="Create" type="submit" />
</form>Code: Select all
<?php
$link = mysql_connect('localhost','root','');
mysql_select_db('gametest',$link);
$CharClass = $_POST['selCharClass'];
$sql = "INSERT INTO characters (CharName, Charclass) ";
$sql = $sql . " values ('$_POST[txtCharName]', '$CharClass')";
// echo $sql;
echo "You have chosen your character.";
?>Aravona