zgkhoo Posted October 17, 2007 Share Posted October 17, 2007 <?php ob_start(); //output buffering begin session_start(); include 'config.php'; include 'opendb.php'; echo "<h1>Place Bet3</h1>"; echo "</br>Mode: ".$_SESSION['mode']; echo "</br>Category: ".$_SESSION['category']; echo "</br>Date:".$_SESSION['date']; //echo "<table border=1>"; //display all the data inside result table //$result=mysql_query("SELECT DrawDate,DrawNumber,Category FROM result") or die('Query failed: ' . mysql_error()); //while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { //echo "<tr><td>$row[DrawDate]</td><td>$row[DrawNumber]</td><td>$row[Category]</td></tr>"; //} //echo "</table>"; //finding the drawnumber.. $result=mysql_query("SELECT DrawDate,DrawNumber,Category FROM result") or die('Query failed: ' . mysql_error()); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { if(($row[DrawDate]==$_SESSION['date'])&&($row[Category]==$_SESSION[category])){ $_SESSION[drawnumber]=$row[DrawNumber]; echo "</br>DrawNumber=".$_SESSION[drawnumber]; } } ?> <html> <table> <form action=placebet3.php method='post'> </br> Betting Number <input type=text name=betnumber> </br> Amount (RM) <input type=text name=amount> </br> <input type=submit name=bet value=Bet> </form> </table> </html> <?php if(isset($_POST[bet])){ $_SESSION['betnumber']=$_POST[betnumber]; $_SESSION['amount']=$_POST[amount]; echo "bet"; [color=red] header ('Refresh:2;url=placebet4.php'); echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>you will be redirected into Confirm page in 2 seconds</font></td></tr></table></center>";[/color] ob_flush(); //$sql="INSERT INTO transaction (DrawNumber,Amount,PurchaseNo,BetMode) //VALUES ('$drawnumber','$_POST[amount]','$_POST[betnumber]','$_SESSION[mode]')"; //mysql_query($sql, $con); } ?> how to clear the screen when the user clicked the button?while currently when the user click the button the system show the message "you will be redirected into Confirm page in 2 seconds" but those element, form/button still appear in there, how can disappear those element when user clicked the button? thanks.. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted October 17, 2007 Share Posted October 17, 2007 Try <?php ob_start(); //output buffering begin session_start(); include 'config.php'; include 'opendb.php'; echo "<h1>Place Bet3</h1>"; echo "</br>Mode: ".$_SESSION['mode']; echo "</br>Category: ".$_SESSION['category']; echo "</br>Date:".$_SESSION['date']; //echo "<table border=1>"; //display all the data inside result table //$result=mysql_query("SELECT DrawDate,DrawNumber,Category FROM result") or die('Query failed: ' . mysql_error()); //while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { //echo "<tr><td>$row[DrawDate]</td><td>$row[DrawNumber]</td><td>$row[Category]</td></tr>"; //} //echo "</table>"; //finding the drawnumber.. $result=mysql_query("SELECT DrawDate,DrawNumber,Category FROM result") or die('Query failed: ' . mysql_error()); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { if(($row[DrawDate]==$_SESSION['date'])&&($row[Category]==$_SESSION[category])){ $_SESSION[drawnumber]=$row[DrawNumber]; echo "</br>DrawNumber=".$_SESSION[drawnumber]; } } if(isset($_POST['bet'])){ $_SESSION['betnumber']=$_POST[betnumber]; $_SESSION['amount']=$_POST[amount]; echo "bet"; [color=red] header ('Refresh:2;url=placebet4.php'); echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>you will be redirected into Confirm page in 2 seconds</font></td></tr></table></center>";[/color] ob_flush(); //$sql="INSERT INTO transaction (DrawNumber,Amount,PurchaseNo,BetMode) //VALUES ('$drawnumber','$_POST[amount]','$_POST[betnumber]','$_SESSION[mode]')"; //mysql_query($sql, $con); exit; } ?> <html> <table> <form action=placebet3.php method='post'> </br> Betting Number <input type=text name=betnumber> </br> Amount (RM) <input type=text name=amount> </br> <input type=submit name=bet value=Bet> </form> </table> </html> Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted October 17, 2007 Author Share Posted October 17, 2007 where u make modification? ??? seem exactly the same exit; <---wat this use for? thanks for helping Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted October 17, 2007 Share Posted October 17, 2007 I moved the code that checks if they pressed submit above the form. Then I added an exit so that the form below wouldn't show when the submit button was pressed. Did you try it? Quote Link to comment Share on other sites More sharing options...
btherl Posted October 17, 2007 Share Posted October 17, 2007 Try this out: <script type="text/javascript"> function show_div(div_name) { var my_div; my_div = document.getElementById ? document.getElementById(div_name) : null; if (my_div) { if (my_div.style) my_div.style.display = ''; else if (my_div.display) my_div.display = ''; } else { //alert('Cant find ' + div_name); } } function hide_div(div_name) { var my_div; my_div = document.getElementById ? document.getElementById(div_name) : null; if (my_div) { if (my_div.style) { my_div.style.display = 'none'; } else if (my_div.display) { alert(div_name); } } } </script><div id="foo">Hide me</div> <input type="button" name="Show" value="Show" onClick="show_div('foo')"> <input type="button" name="Hide" value="Hide" onClick="hide_div('foo')"> Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted October 17, 2007 Author Share Posted October 17, 2007 Parse error: syntax error, unexpected '[' in C:\xampp\Sportstoto\sportstoto\placebet5.php on line 42 Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted October 17, 2007 Author Share Posted October 17, 2007 <?php ob_start(); //output buffering begin session_start(); include 'config.php'; include 'opendb.php'; echo "<h1>Place Bet3</h1>"; echo "</br>Mode: ".$_SESSION['mode']; echo "</br>Category: ".$_SESSION['category']; echo "</br>Date:".$_SESSION['date']; //echo "<table border=1>"; //display all the data inside result table //$result=mysql_query("SELECT DrawDate,DrawNumber,Category FROM result") or die('Query failed: ' . mysql_error()); //while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { //echo "<tr><td>$row[DrawDate]</td><td>$row[DrawNumber]</td><td>$row[Category]</td></tr>"; //} //echo "</table>"; //finding the drawnumber.. $result=mysql_query("SELECT DrawDate,DrawNumber,Category FROM result") or die('Query failed: ' . mysql_error()); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { if(($row[DrawDate]==$_SESSION['date'])&&($row[Category]==$_SESSION[category])){ $_SESSION[drawnumber]=$row[DrawNumber]; echo "</br>DrawNumber=".$_SESSION[drawnumber]; } } if(isset($_POST['bet'])){ $_SESSION['betnumber']=$_POST[betnumber]; $_SESSION['amount']=$_POST[amount]; echo "bet"; //[color=red] header ('Refresh:2;url=placebet4.php'); echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>you will be redirected into Confirm page in 2 seconds</font></td></tr></table></center>"; ob_flush(); //$sql="INSERT INTO transaction (DrawNumber,Amount,PurchaseNo,BetMode) //VALUES ('$drawnumber','$_POST[amount]','$_POST[betnumber]','$_SESSION[mode]')"; //mysql_query($sql, $con); exit; } ?> <html> <table> <form action=placebet3.php method='post'> </br> Betting Number <input type=text name=betnumber> </br> Amount (RM) <input type=text name=amount> </br> <input type=submit name=bet value=Bet> </form> </table> </html> i changed to above, still the same..the form still wont disappear when the user click the button Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 17, 2007 Share Posted October 17, 2007 PHP can not clear the screen. You need to use Javascript. I'm moving this thread to the Javascript area. Ken Quote Link to comment Share on other sites More sharing options...
corbin Posted October 17, 2007 Share Posted October 17, 2007 To hide an element with javascript is fairly simple.... I'm not going to integrate this into your script mainly because I'm feeling lazy, and it'll give you something to do ;p. <script language="javascript"> function Hide(elem) { e = document.getElementById(elem); e.style.display = "none"; } </script> <div id="hideThis"> now you see it! </div> <a href="#" onclick="Hide('hideThis');">Hide It</a> You would want to mod that though since that'll have problems in some browsers.... Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted October 17, 2007 Share Posted October 17, 2007 I completely took your question the wrong way. Sorry about that, just disregard my previous posts. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.