IB computer science HL October 18 2016 Lesson Notes: Difference between revisions
Mr. MacKenty (talk | contribs) (Created page with " __NOTOC__ <table cellspacing="10" style="width:100%;"> <tr> <td style="width:50%; margin:0; margin-top:10px; margin-right:10px; border:1px solid #dfdfdf; padding:0 1em 1em 1...") |
Mr. MacKenty (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
# Today in class we will apply our understanding of php and arrays as we work on a RPG character creation system | # Today in class we will apply our understanding of php and arrays as we work on a RPG character creation system | ||
# we will revisit conditionals | # we will revisit conditionals | ||
The HTML form: | |||
<syntaxhighlight lang="html"> | <syntaxhighlight lang="html"> | ||
Line 42: | Line 44: | ||
</html> | </html> | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="php"> | |||
<?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>"; | |||
?> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 52: | Line 94: | ||
==[[file:homework.png]] Homework == | ==[[file:homework.png]] Homework == | ||
# | # Learn and apply sessions to our character generation program | ||
Latest revision as of 13:27, 18 October 2016
|
|
|
|
||
|
|
|
|