Jump to content

HTML code dissaperaing after PHP code


soma56

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.