soma56 Posted July 3, 2010 Share Posted July 3, 2010 I have a page that contains html and php. When the php is called everything beneath it (all the html) disappears. Here's an example: <html> <body> <form action="" method="post"> <table width="500"> <tr><td>What's your name?<input name="name" type="text" /></td></tr> <tr><td><input type=Submit value="Enter Name" name="Submit"></td></tr> <?PHP if (isset($_POST['Submit'])) { echo $name; unset($targetkeyword); } ?> </table></form> <table width="500"> <tr><td>This text is not displayed when and after PHP function is set</td></tr> </table> </body> </html> When the page initially loads I can see everything however once the submit button is clicked everything after the php code is gone - even after the PHP has completed doing it's thing. Link to comment https://forums.phpfreaks.com/topic/206643-html-code-dissaperaing-after-php-code/ Share on other sites More sharing options...
Pikachu2000 Posted July 3, 2010 Share Posted July 3, 2010 I think it's because you're trying to echo something within the table's structure, but not echoing the proper <tr><td></td></tr> structure with it, thereby breaking the table structure. if (isset($_POST['Submit'])) { echo "<tr><td>{$_POST['name']}</td></tr>"; unset($targetkeyword); } Link to comment https://forums.phpfreaks.com/topic/206643-html-code-dissaperaing-after-php-code/#findComment-1080757 Share on other sites More sharing options...
soma56 Posted July 3, 2010 Author Share Posted July 3, 2010 Thanks, removing the table solved it. CSS will work better. Link to comment https://forums.phpfreaks.com/topic/206643-html-code-dissaperaing-after-php-code/#findComment-1080764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.