示例#1
0
        print "Error";
        break;
}
?>
	</head>
	<body>
	<div class="wrap">
	<div class="toogle">
		<?php 
$connectionstring = mysql_connect("localhost", "root");
if ($connectionstring == 0) {
    die("cannot connect to the db");
}
$db = mysql_select_db("4432project", $connectionstring) or die("cannot open the selected db");
$foodName = $thisPok->getFoodName();
$foodNum = $thisPok->getFoodNum();
switch ($choice) {
    case 'feed':
        print '<div class=\\"btn_form\\" align="center"><form method="POST" action="confirm.php?PID=' . $PID . '&choice=feed" ><p class="m_text">';
        print "You have {$foodNum} {$foodName}. Choose how many you want to feed:<br />";
        print '<input type="range" name="range" id="range" min="0" max="' . $foodNum . '" value="0" step="1" 
							onchange="showValue(this.value)" />';
        print '<span name="showRange" id="showRange">0</span><br />';
        print "<input type=\"submit\" value=\"Confirm\" />";
        break;
    case 'marry':
        $UserID = $_SESSION['userid'];
        print '<div class="btn_form" align="center"><form method="POST" action="confirm.php?PID=' . $PID . '&choice=marry" ><p class="m_text">';
        print "Choose the one you want your pokemon to marry: <br />";
        print '<div><select id="mary" name="marry">';
        print '<option value="null">Select a marriage</option>';
示例#2
0
	<link href="./css/style.css" rel="stylesheet" type="text/css" />
	<link href="./css/form.css" rel="stylesheet" type="text/css" />
	<title>Confirmation</title>
	<?php 
print '<meta http-equiv="refresh" content="60;URL="confirm.php?PID=' . $PID . '&choice=' . $choice . '">';
?>
</head>
<body>
<div class="wrap">
<div class="toggle">
	<p class="m_text" align="middle">
<?php 
switch ($choice) {
    case 'feed':
        $amount = $_POST['range'];
        if ($amount <= $thisPok->getFoodNum()) {
            $thisPok->setFood($amount);
        }
        print "<br />You have successfully fed the pokemon XD<br /><br />";
        print "<div class=\"btn_form\" align=\"middle\"><form>";
        print "<input type=\"button\" align=\"middle\" value=\"Yeah!!\" onclick=\"window.open('', '_self', ''); window.close();\" />";
        print "</form></div>";
        break;
    case 'marry':
        $MarriageID = $_POST['marry'];
        $thisPok->marry($MarriageID);
        print "<br />You have successfully send out the engagement XD<br /><br />";
        print "<div class=\"btn_form\" align=\"middle\"><form>";
        print "<input type=\"button\" align=\"middle\" value=\"Yeah!!\" onclick=\"window.open('', '_self', ''); window.close();\" />";
        print "</form></div>";
        break;