hi
i am using php to do my web site and using mysql data base.
i am trying to enter data to the data base. And in the form i use, one field is a rich text field (taken from FCKeditor). The rich text field appear as a php server mark up and not as a text field. There for when the form has not identified it as a text field when entering data to the data base. i Am not knoledgable about php.
So how can i do use this rich text field in the normal form?please help me
sisira
this is my page coding
<?php require_once('../Connections/utf8_general_ci.php'); ?>
<?php include_once("fckeditor/fckeditor.php") ; ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $SERVER['PHP_SELF'];
if (isset($SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($POST["MM_insert"])) && ($POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO jokes (name, joke, category, Language) VALUES (%s, %s, %s, %s)",
GetSQLValueString($POST['name'], "text"),
GetSQLValueString($POST['joke'], "text"),
GetSQLValueString($POST['category'], "text"),
GetSQLValueString($POST['Language'], "text"));
mysql_select_db($database_utf8_general_ci, $utf8_general_ci);
$Result1 = mysql_query($insertSQL, $utf8_general_ci) or die(mysql_error());
$insertGoTo = "../Admin%20Data/Jokes.php";
if (isset($SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>JOKES</p>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<table width="100%" >
<tr>
<td> </td>
<td><input name="name" type="text" id="name" size="60"></td>
</tr>
<tr>
<td> </td>
<td><?php
$oFCKeditor = new FCKeditor('joke') ;
$oFCKeditor->BasePath = '/fckeditor/' ;
$oFCKeditor->Value = '<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.<p></p>' ;
$oFCKeditor->Create() ; ?></td>
</tr>
<tr>
<td> </td>
<td><select name="category" id="category">
<option>Animals</option>
<option>Answer Machine</option>
<option>Aviation</option>
<option>Bar Jokes</option>
<option>Blind Jokes</option>
<option>Blonde Jokes</option>
<option>Business</option>
<option>Car Bumpers</option>
<option>Computers</option>
<option>Crazy Jokes</option>
<option>Dumb Laws</option>
<option>English</option>
<option>Ethnic Jokes</option>
<option>Farmers</option>
<option>Fishing</option>
<option>Food Jokes</option>
<option>Funny Ads</option>
<option>Funny Puns</option>
<option>Funny Guides</option>
<option>Funny Tests</option>
<option>Gender</option>
<option>Golf Jokes</option>
<option>Heaven, Hell</option>
<option>Holidays</option>
<option>Indians</option>
<option>Insults</option>
<option>Idiots</option>
<option>Kids Jokes</option>
<option>Lawyers</option>
<option>Light Bulbs</option>
<option>Maths Jokes</option>
<option>Marriage</option>
<option>Medical</option>
<option>Militory</option>
<option>Music</option>
<option>Office Jokes</option>
<option>Old Age</option>
<option>One Liners</option>
<option>Parents</option>
<option>Political</option>
<option>Police Jokes</option>
<option>Redneck</option>
<option>Religious</option>
<option>Science</option>
<option>School</option>
<option>Shopping</option>
<option>Sick Jokes</option>
<option>Sports</option>
<option>State Jokes</option>
<option>Thoughts</option>
<option>Top Lists</option>
<option>Travel Jokes</option>
<option>True Stories</option>
<option>Yo Mama</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><select name="Language" id="Language">
<option selected>English</option>
<option>Sinhala</option>
<option>French</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>