Yohanne Posted March 25, 2013 Share Posted March 25, 2013 Hi all, Could you help if what is the correct syntax for this? <a href="javascript:void(0)" onclick = "window.open('newaccount.php?admin32=<?php echo substr(sha1($rows['a_id']),4,30) ?>','','top=60,left=250,right=200,width=300, height=500,menubar=no,alignment=center')">Account</a> and when i remove line below the code is working. ?admin32=<?php echo substr(sha1($rows['a_id']),4,30) ?> Quote Link to comment https://forums.phpfreaks.com/topic/276118-how-it-works-onclick/ Share on other sites More sharing options...
Barand Posted March 25, 2013 Share Posted March 25, 2013 javascript runs on the client after php has finished execution on the server Quote Link to comment https://forums.phpfreaks.com/topic/276118-how-it-works-onclick/#findComment-1420913 Share on other sites More sharing options...
PaulRyan Posted March 25, 2013 Share Posted March 25, 2013 (edited) You are missing the semi-colon from the end of the echo. <?PHP echo substr(sha1($rows['a_id']),4,30); ?> You would know that, if you had error reporting turned on. Edited March 25, 2013 by PaulRyan Quote Link to comment https://forums.phpfreaks.com/topic/276118-how-it-works-onclick/#findComment-1420928 Share on other sites More sharing options...
Barand Posted March 25, 2013 Share Posted March 25, 2013 (edited) Instruction separation As in C or Perl, PHP requires instructions to be terminated with a semicolon at the end of each statement. The closing tag of a block of PHP code automatically implies a semicolon; you do not need to have a semicolon terminating the last line of a PHP block. PS Forget my previous comment Edited March 25, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/276118-how-it-works-onclick/#findComment-1420933 Share on other sites More sharing options...
xenophobia Posted March 26, 2013 Share Posted March 26, 2013 Your onclick event code doesn't look like having any problem. I believe it was your php code. Try load the page and view the source, look for the line. Because sometime if PHP throw an error inside the HTML tag, you can't view it on your page. Verify the PHP code before troubleshooting your javascript =) Quote Link to comment https://forums.phpfreaks.com/topic/276118-how-it-works-onclick/#findComment-1421120 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.