Jump to content

[SOLVED] Can't get mysql to save <img> tags and other html


pneudralics

Recommended Posts

When I just use regular text in my form it saves it but when I try to enter the below it doesn't save it. Can't figure why..If I manually enter it in the database it'll save it.

 

blahblabh<br>yayaya<br>testing one two<br><img alt="" src="http://l" align="none"><img alt="mustang" src="http://localhost/gallery/mustang1.jpg" align="none"><br>   
    

 

php page

<?php
//This is the page for updating the policy section
session_start();
if(!isset($_SESSION['username'])){ 
require ("error.php"); 
} else { 
include ('header2.php');
?>
<table width="800" align="center">
<tr>
    <td align="center">
This section updates the policy section. Clicking on the save button will override the current policy information.
    </td>
    </tr>
</table>
<br />
<table width="800" align="center">
<tr>
    <td align="center">
<?php
//Update policy
if (isset ($_POST['submit'])) {
$policy = ($_POST['policy']);

if ( !empty ($policy) ) {
//Update...
$updatepolicy = "UPDATE policy SET policy=\"$policy\"";
$updatepolicyresult = mysql_query ($updatepolicy);
echo '<font color="red">Policy section has been updated.</font><br /><br />';	
}
else {
echo '<font color="red">Policy section is empty.</font><br /><br />';	
}
}
?>  [<a href="../policy.php" target="_blank">View Policy Section</a>]
<br />
    <br />
    <b>Update Policy Section Below</b>
    <br />
<form method="post" action="policy.php">
    <textarea name="policy" cols="40" rows="20">
<?php
//Retrieve policy info
$policyselect = "SELECT * FROM policy";

if ($policyresult = mysql_query ($policyselect)) {
while ($row = mysql_fetch_array ($policyresult)) {
$policy = $row['policy'];
}
}
echo "$policy";
?>   
    </textarea>
    <br />
    <br />
    <input type="submit" name="submit" value="Save" />
    </form>
    </td>
    </tr>
</table>
<?php
}//End session else
?>
SS

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.