IB computer science HL October 18 2016 Lesson Notes
What are we going to learn today?[edit]
The HTML form: <!doctype html>
<html>
<!-- welcome to our simple chargen system -->
<form action="char_gen.php" method="post">
<p><label>Pay to win:
<input type="radio" name="paytowin" value="yes">Yes
<input type="radio" name="paytowin" value="no">No
</label></p>
<p>Race:
<br />
<br />
<input type="radio" name="race" value="elf">Elf<br />
<input type="radio" name="race" value="dwarf">Dwarf<br />
<input type="radio" name="race" value="human">Human<br />
<input type="radio" name="race" value="khajit">Khajiit<br />
<input type="radio" name="race" value="gnome">Gnome<br />
<input type="radio" name="race" value="centaur">Centaur<br />
</p>
<p>Gender:
<br />
<br />
<input type="radio" name="gender" value="male">Male<br />
<input type="radio" name="gender" value="female">Female<br />
<input type="radio" name="gender" value="other">Other<br />
</p>
<p><input type="submit" value="Onto step 2!" /></p>
</form>
</html>
<?php
$pay_to_win = $_POST['paytowin'];
$race = $_POST['race'];
$gender = $_POST['gender'];
echo "debug: you are passing pay to win = $pay_to_win, race = $race
and gender = $gender";
if ($pay_to_win == "yes")
{
$strength = mt_rand(50,100);
$intelligence = mt_rand(0,50);
$agility = mt_rand(50,100);
}
else
{
$strength = mt_rand(0,100);
$intelligence = mt_rand(0,100);
$agility =mt_rand(0,100);
}
echo "<p>Strength: $strength </p>";
echo "<p>Intelligence: $intelligence </p>";
echo "<p>Agility: $agility </p>";
?>
|
Homework[edit]
|
|
How am I being assessed today?[edit]
|
||
Standards we are covering today[edit]
|
As a computer scientist, you have:[edit]
|
|
Credits[edit] |