0 tcollins412 7 Years Ago i have a div like <form method='post' action='send'><div id='fail' name='cool'>300</div><input type='submit' value='submit'></form> now how would i call that into a variable in php? i tried $cool=$_POST['cool']; but it didnt work. help php post
0 chrishea 182 7 Years Ago You need a form field to create a POST variable. <input type=... > http://innovationsdesign.net/wb_2.7/pages/tech-resources/php-help.php#question_8
0 vinayakgarg 6 7 Years Ago try this <div id='fail' name='cool'>300</div> <form method="post" action="send.php" name="form1"> <input type="hidden" name="field"> <input type='submit' value='submit' onclick="document.form1.field.value=document.getElementById('fail').innerHTML"> </form>
0 morteza_ipo 7 Years Ago Test it! <html> <head> <script language="javascript"> function send() { document.getElementById('div_content').value = document.getElementById('content').innerHTML; document.forms['form1'].submit(); } </script> </head> <body> <?php if($_POST) { echo $_POST['div_content']; } ?> <form name="form1" action="" method="post"> <input type="hidden" id="div_content" name="div_content" /> <div id="content">this is test</div> <input type="button" onclick="send()" value="Send" /> </form> </body> </html> By javascript I put div content ("innerHTML") into hidden tag! And after that by javascript I send my from! Edited 7 Years Ago by morteza_ipo: n/a