believeinsharing Posted October 12, 2011 Share Posted October 12, 2011 Hi All, I am developing PHP website. In my initial stage I wanted to accept some information from user... after that I wanted to display that information in different div but on same page... Lets say My page is having two div tags. First div for simple HTML form which will help user to enter data, second div to display info entered by user. I am doing this because I wanted to hide second div until user enter info into form and hit submit button. Its working fine when page load first time. second div is hidden, user add info and hit submit button then second div comes with info added by user. But when i refresh, its showing second div with previous info. As I am new to php and javascript I am not sure what to do.. Let me knw if some have any idea to solve this, Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/248979-clear-variable-php/ Share on other sites More sharing options...
cunoodle2 Posted October 12, 2011 Share Posted October 12, 2011 step 1 is to share your code. Without it we are of zero help to you Quote Link to comment https://forums.phpfreaks.com/topic/248979-clear-variable-php/#findComment-1278645 Share on other sites More sharing options...
believeinsharing Posted October 12, 2011 Author Share Posted October 12, 2011 My php file is: <html> <head><title>Create Coupons</title></head> <body> <div id="pageHeading"> Add following information to crate a coupon </div> <div id="couponForm"> <form name="couponInfo" method="post"> <table> <tr><td>Enter coupon Heading:</td> <td><input type="text" name="txtHeading"/> </td></tr> <tr> <td>Enter coupon subheading:</td> <td><input type="text" name="txtsubHeading"/></td> </tr> <tr> <td>Enter detail:</td> <td><input type="text" name="txtdetail"/></td> </tr> <tr> <td>Enter validity date:</td> <td><input type="text" name="txtDate"/></td> </tr> <tr> <td>Select Image:</td> <td><input type="file" name="couponImg" accept="image/gif, image/jpg, image/png"/></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" value="Create Coupon" onclick="generateCoupon.js();"/> </td> </tr> </table> </form> </div> <div id="couponSample"> <?php $heading =$_POST["txtHeading"]; $subheading=$_POST["txtsubHeading"]; $detail=$_POST["txtdetail"]; $validthr=$_POST["txtDate"]; echo ($heading . "<br/>"); echo($subheading . "<br/>"); echo($detail . "<br/>"); echo($validthr . "<br/>"); ?> </div> </body> </html> my Javascript code is: function generateCoupon() { { var showdiv = document.getElementById("couponSample"); var frmdiv=document.getElementById("couponForm"); if(showdiv.style.display=="block") { showdiv.style.display="none"; frmdiv.innerHTML="show"; } else { showdiv.style.display="block"; frmdiv.innerHTML="hide"; } } } Quote Link to comment https://forums.phpfreaks.com/topic/248979-clear-variable-php/#findComment-1278667 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.