robert_gsfame Posted April 11, 2010 Share Posted April 11, 2010 i have javascript code that will pass the value into html let say document.getElementById('show').innerHTML="aaaa" and i have <?php $a=1; echo "<a href='page1.php?id=$a&show=<div id=show></div>'> ?> can i put div id inside a href?? if yes then how? thx Quote Link to comment Share on other sites More sharing options...
newbtophp Posted April 11, 2010 Share Posted April 11, 2010 urlencode() the div/html then urldecode() the $_GET['show'] on page1.php Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted April 11, 2010 Author Share Posted April 11, 2010 could u please explain a bit Quote Link to comment Share on other sites More sharing options...
teamatomic Posted April 11, 2010 Share Posted April 11, 2010 $div=<div id=show></div>''; $div=htmlentities($div); echo "<a href='page1.php?id=$a&show=$div'>"; HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted April 11, 2010 Author Share Posted April 11, 2010 i really don't get......what should i urlencode the div if i urlencode the div, i will have this on my url &show=<div+id%3D'show'><%2Fdiv> i want to get the value of div from javascript which is "aaa" I don't think using urlencode or htmlentities will solve the problem Quote Link to comment Share on other sites More sharing options...
teamatomic Posted April 11, 2010 Share Posted April 11, 2010 Only way I know to pass from js to php is to put the value in a var and then use window.location.href or document.write and put the var into the url. HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted April 11, 2010 Author Share Posted April 11, 2010 yeah i use window.location.href and pass php value that i retrieve from database and it works! 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.