robert_gsfame Posted June 5, 2010 Share Posted June 5, 2010 i have this code if(!empty($_SESSION['username'])){ $val="window.location.href='test1.php'";}else{ $val="alert('Need login session')";} echo "<input type=button value=Button onclick=$val>"; when i change the $val alert with alert('Login'), it works..... so the problem is that the alert cannot contain space..how can i do this? thanks Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted June 5, 2010 Share Posted June 5, 2010 change this: echo "<input type=button value=Button onclick=$val>"; to this: echo "<input type='button' value='Button' onclick=\"$val\">"; Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted June 5, 2010 Author Share Posted June 5, 2010 Thx! 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.