Awhile ago I learned a card trick and though it would be neat to re-create it online minus the cards but just the "trick". I didn't do a great job with the css so don't ask me why I used css and in-line style changes on the same page..lol
Magic?
Here is the complete page to make it
<!-- Created By: Danny Tucker [2006] -->
<html>
<head>
<title>Magic?</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #161616;
}
a:link {
color: #FFFF33;
font-weight: bold;
}
a:visited {
color: #FFFF33;
}
a:hover {
color: #FFCC00;
}
a:active {
color: #FF0000;
}
td {
font-weight: bold;
}
-->
</style>
</head>
<body>
<ul>
<li>Directions:
<ul>
<li>Choose any number</li>
<li>Select the column that number resides in </li>
<li>Click Proceed</li>
<li>Repeat 2 more time keeping the same number you choose to begin with </li>
</ul>
</li>
</ul><br>
<?
if(isset($_POST['send1']))
{
$row_in = $_POST['row'];
$row1 = $_POST['row1'];
$row2 = $_POST['row2'];
$row3 = $_POST['row3'];
//echo $row1.'<br>'.$row2.'<br>'.$row3.'<br>';
if($row_in==1)
$stack = $row2 . $row1 . $row3;
elseif($row_in==2)
$stack = $row1 . $row2 . $row3;
else
$stack = $row1 . $row3 . $row2;
$n = explode(' ',$stack);
?>
<form action="" method="post">
<input type="hidden" name="row1" value="<? echo $row1; ?>">
<input type="hidden" name="row2" value="<? echo $row2; ?>">
<input type="hidden" name="row3" value="<? echo $row3; ?>">
<table width="250" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#000000">
<?
$c = 0;
for($x=1;$x<=7;$x++)
{
echo "<tr><td align=\"center\">$n[$c]</td><td align=\"center\">".$n[$c+1]."</td><td align=\"center\">".$n[$c+2]."</td><tr>";
$c = $c + 3;
}
$row1 = $n[0].' '.$n[3].' '.$n[6].' '.$n[9].' '.$n[12].' '.$n[15].' '.$n[18].' ';
$row2 = $n[1].' '.$n[4].' '.$n[7].' '.$n[10].' '.$n[13].' '.$n[16].' '.$n[19].' ';
$row3 = $n[2].' '.$n[5].' '.$n[8].' '.$n[11].' '.$n[14].' '.$n[17].' '.$n[20].' ';
?>
<input type="hidden" name="row1" value="<? echo $row1; ?>">
<input type="hidden" name="row2" value="<? echo $row2; ?>">
<input type="hidden" name="row3" value="<? echo $row3; ?>">
<tr>
<td bgcolor="#000066"><div align="center">
<input name="row" type="radio" value="1" checked>
</div></td>
<td bgcolor="#000066"><div align="center">
<input type="radio" name="row" value="2">
</div></td>
<td bgcolor="#000066"><div align="center">
<input name="row" type="radio" value="3">
</div></td></tr>
<tr>
<td colspan="3" align="center" bgcolor="#660000">
<input type="submit" name="send2" value="Proceed"></td>
</tr>
</table>
</form>
<?
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
}elseif(isset($_POST['send2']))
{
$row_in = $_POST['row'];
$row1 = $_POST['row1'];
$row2 = $_POST['row2'];
$row3 = $_POST['row3'];
//echo $row1.'<br>'.$row2.'<br>'.$row3.'<br>';
if($row_in==1)
$stack = $row2 . $row1 . $row3;
elseif($row_in==2)
$stack = $row1 . $row2 . $row3;
else
$stack = $row1 . $row3 . $row2;
$n = explode(' ',$stack);
?>
<form action="" method="post">
<input type="hidden" name="row1" value="<? echo $row1; ?>">
<input type="hidden" name="row2" value="<? echo $row2; ?>">
<input type="hidden" name="row3" value="<? echo $row3; ?>">
<table width="250" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#000000">
<?
$c = 0;
for($x=1;$x<=7;$x++)
{
echo "<tr><td align=\"center\">$n[$c]</td><td align=\"center\">".$n[$c+1]."</td><td align=\"center\">".$n[$c+2]."</td><tr>";
$c = $c + 3;
}
$row1 = $n[0].' '.$n[3].' '.$n[6].' '.$n[9].' '.$n[12].' '.$n[15].' '.$n[18].' ';
$row2 = $n[1].' '.$n[4].' '.$n[7].' '.$n[10].' '.$n[13].' '.$n[16].' '.$n[19].' ';
$row3 = $n[2].' '.$n[5].' '.$n[8].' '.$n[11].' '.$n[14].' '.$n[17].' '.$n[20].' ';
?>
<input type="hidden" name="row1" value="<? echo $row1; ?>">
<input type="hidden" name="row2" value="<? echo $row2; ?>">
<input type="hidden" name="row3" value="<? echo $row3; ?>">
<tr>
<td bgcolor="#000066"><div align="center">
<input name="row" type="radio" value="1" checked>
</div></td>
<td bgcolor="#000066"><div align="center">
<input type="radio" name="row" value="2">
</div></td>
<td bgcolor="#000066"><div align="center">
<input name="row" type="radio" value="3">
</div></td></tr>
<tr>
<td colspan="3" align="center" bgcolor="#660000">
<input type="submit" name="send3" value="Proceed"></td>
</tr>
</table>
</form>
<?
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
}elseif(isset($_POST['send3']))
{
$row = $_POST['row'];
$row = $_POST['row'.$row];
$n = explode(' ',$row);
echo 'This is the number you picked -> <b>'.$n[3].'</b>';
echo '<br><br>Magic? Try again and see.. <a href="magic.php">TRY AGAIN</a>';
echo '<br><br>*There are 21 numbers and only 3 columns. You choose the column only 3 times. Can you do that math?';
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
}else
{
$n = array('1','2','3','4','5','6','7',
'8','9','10','11','12','13','14',
'15','16','17','18','19','20','21');
$next = rand(1,20);
for($x=0;$x <= $next;$x++)
{
shuffle($n);
}
$row1 = $n[0].' '.$n[3].' '.$n[6].' '.$n[9].' '.$n[12].' '.$n[15].' '.$n[18].' ';
$row2 = $n[1].' '.$n[4].' '.$n[7].' '.$n[10].' '.$n[13].' '.$n[16].' '.$n[19].' ';
$row3 = $n[2].' '.$n[5].' '.$n[8].' '.$n[11].' '.$n[14].' '.$n[17].' '.$n[20].' ';
$c = 0;
?>
<form action="" method="post">
<input type="hidden" name="row1" value="<? echo $row1; ?>">
<input type="hidden" name="row2" value="<? echo $row2; ?>">
<input type="hidden" name="row3" value="<? echo $row3; ?>">
<table width="250" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#000000">
<?
for($x=1;$x<=7;$x++)
{
echo "<tr><td align=\"center\">$n[$c]</td><td align=\"center\">".$n[$c+1]."</td><td align=\"center\">".$n[$c+2]."</td><tr>";
$c = $c + 3;
}
?>
<tr>
<td bgcolor="#000066"><div align="center">
<input name="row" type="radio" value="1" checked >
</div></td>
<td bgcolor="#000066"><div align="center">
<input type="radio" name="row" value="2">
</div></td>
<td bgcolor="#000066"><div align="center">
<input name="row" type="radio" value="3">
</div></td></tr>
<tr>
<td colspan="3" align="center" bgcolor="#660000">
<input type="submit" name="send1" value="Proceed"></td>
</tr>
</table>
</form>
<?
}
?>
</body>
</html>