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 Link to comment https://forums.phpfreaks.com/topic/203932-echo-alert-not-working/ 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\">"; Link to comment https://forums.phpfreaks.com/topic/203932-echo-alert-not-working/#findComment-1068049 Share on other sites More sharing options...
robert_gsfame Posted June 5, 2010 Author Share Posted June 5, 2010 Thx! Link to comment https://forums.phpfreaks.com/topic/203932-echo-alert-not-working/#findComment-1068050 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.