Hi
I am new to PHP coding as I used to create my pages in HTML. I have a form on a site that enables the users to enter various data. I did not create the page, it came with the site, however, I did add all the fields, except for the first 2. My problem is that the description field is only on one line and I need it to be a text area. I added the information field, it does appear as a text area, but when I click on Sauvegarder (save), the field empties and of course that information is not posted.
The page code is below
Both the Information and Description fields are mediumblob in the SQL table.
Any help would be greatly appreciated
Thanks
function posteEdit() {
global $config, $connection,$UserInfo;
$id = 0;
$edit = false;
if ($_REQUEST['mode'] == "view")
$view = true;
if ($_REQUEST['mode'] == "edit")
$edit = true;
if ($_REQUEST['save'] != "") {
if ($edit) {
$SQL = 'UPDATE PosteDisponible_db SET Title = "' . mysql_real_escape_string($_REQUEST['title']) . '", DateDisp = "' . mysql_real_escape_string($_REQUEST['datedisp']) . '", Cabinet = "' . mysql_real_escape_string($_REQUEST['cabinet']) . '", Contact = "' . mysql_real_escape_string($_REQUEST['contact']) . '", Information = "' . mysql_real_escape_string($_REQUEST['information']) . '", Courriel = "' . mysql_real_escape_string($_REQUEST['courriel']) . '", Description = "' . mysql_real_escape_string($_REQUEST['description']) . '", Body = "' . mysql_real_escape_string($_REQUEST['body']) . '", Deleted = "' . mysql_real_escape_string($_REQUEST['deleted']) . '" ';
$SQL .= ", ModifiedDate = NOW()";
$SQL .= ", ModifiedBy = '" .$UserInfo["Usager_id"] . "'";
$SQL .= 'WHERE id = "' . mysql_real_escape_string($_REQUEST['id']) . '"';
} else {
$SQL = 'INSERT INTO PosteDisponible_db (Type,Title,DateDisp,Cabinet,Contact,Information,Courriel,Description,Body,Filename,Filetype,Document,CreateDate,CreateBy) VALUES("' . mysql_real_escape_string($_REQUEST['Type']) . '","' . mysql_real_escape_string($_REQUEST['title']) . '","' . mysql_real_escape_string($_REQUEST['datedisp']) . '","' . mysql_real_escape_string($_REQUEST['cabinet']) . '","' . mysql_real_escape_string($_REQUEST['contact']) . '","' . mysql_real_escape_string($_REQUEST['information']) . '","' . mysql_real_escape_string($_REQUEST['courriel']) . '","' . mysql_real_escape_string($_REQUEST['description']) . '","' . mysql_real_escape_string($_REQUEST['body']) . '",NOW(),"' . $UserInfo['Usager_id'] . '")';
}
$query = mysql_db_query($config["DB"], $SQL, $connection);
$id = mysql_insert_id($connection);
}
if ($id == 0) {
$id = mysql_real_escape_string($_REQUEST['id']);
}
$SQL = 'SELECT * FROM PosteDisponible_db WHERE id = "'.$id .'"';
$query = mysql_db_query($config["DB"], $SQL, $connection);
$row = mysql_fetch_array($query);
if($row["Deleted"] == "O")
$dDeletedY = "selected";
if($row["Deleted"] == "N")
$dDeletedN = "selected";
$Type = $row['Type'];
$nchoix = "edit";
$npart = $_REQUEST['part'];
echo "<P ALIGN=\"RIGHT\"><a href=\"http://www.alaquebec.org/index.phtml?part=repertoire\" target=\"_top\"><font color=\"#800000\" size=\"3\">Retour au répertoire</font></a><P ALIGN=\"LEFT\">";
echo "<form name=\"posteform\" ENCTYPE=\"multipart/form-data\" method=\"POST\" action=\"".$config["index"]."\">";
echo "<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1024000\">";
echo "<INPUT TYPE=\"hidden\" name=\"part\" value=\"$npart\">";
echo "<INPUT TYPE=\"hidden\" name=\"choix\" value=\"$nchoix\">";
echo "<INPUT TYPE=\"hidden\" name=\"id\" value=\"$id\">";
if ($id != 0)
echo "<INPUT TYPE=\"hidden\" name=\"mode\" value=\"edit\">";
echo "<table class=\"darkstd\" border=\"0\" width=\"100%\" cellspacing=\"1\">";
echo "<p style=\"margin-left: 125px\">";
// Config des cols
echo " <tr>";
echo " <td class=\"darkstd\" colspan=\"2\" ALIGN=\"LEFT\">";
echo "<b><font color=\"".$config["cellheadtext"]."\"size=\"3\">";
if ($id == 0) {
echo "Nouveau Poste";
} else {
echo $id;
}
echo "</font></b></td>";
echo " </tr>";
echo " <tr>";
if ($view != true) {
if ($Type == '') {
$typeForm = "<select size=\"1\" name=\"Type\">";
$typeForm .= "<option value=\"E\">Employé disponible</option>";
$typeForm .= "<option value=\"P\">Poste Disponible</option>";
$typeForm .= "</select>";
} else {
switch ($Type) {
case "E":
$typeForm = "Employé disponible";
break;
case "P":
$typeForm = "Poste Disponible";
break;
}
}
puttblrowdefinputtxt("Type :",$typeForm);
puttblrowdefinputtxt("Titre :","",$row['Title'],"title",33);
puttblrowdefinputtxt("Disponible :","",$row['DateDisp'],"datedisp",33);
puttblrowdefinputtxt("Cabinet :","",$row['Cabinet'],"cabinet",33);
puttblrowdefinputtxt("Contact :","",$row['Contact'],"contact",33);
puttblrowdefinputtxt("Courriel :","",$row['Courriel'],"courriel",33);
echo “
echo “<td class=“darkstd” width=”$widthleft" align=“right”>";
echo “<p align=“right”><font color=”".$config[“cellheadtext”]."">Information";
echo “”;
echo “<td class=“lightstd” width=”$widthright"> <textarea rows=“12” name=“Information” cols=“31”>$dInformation";
echo “
puttblrowdefinputtxt("Description :","",$row['Description'],"description",33);
} else {
puttblrowdefinputtxt("Titre :",$row['Title']);
puttblrowdefinputtxt("Disponible :",$row['DateDisp']);
puttblrowdefinputtxt("Cabinet :",$row['Cabinet']);
puttblrowdefinputtxt("Contact :",$row['Contact']);
puttblrowdefinputtxt("Courriel :",$row['Courriel']);
puttblrowdefinputtxt("Information :",$row['Information']);
puttblrowdefinputtxt("Description :",$row['Description']);
}
echo " <tr>";
echo " <td class=\"darkstd\" width=\"486\" align=\"right\" colspan=\"2\">";
echo " <p align=\"left\">";
//CODE AJOUTÉ
//echo " <td valign=“top”>";
//echo " <p align=“left”><font color="".$config[“cellheadtext”]."">Description
//echo " “;
//echo " <td class=“lightstd” align=“left”><textarea rows=“15” name=“description” cols=“33”>$Description”;
//echo " ";
//FIN DU CODE AJOUTÉ
if ($view == true) {
echo $row['Body'];
} else {
// include("./FCKeditor/fckeditor.php") ;
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// $oFCKeditor->BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
// $sBasePath = $_SERVER[‘PHP_SELF’] ;
// $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, “_samples” ) ) ;
// $oFCKeditor = new FCKeditor(‘body’) ;
// $oFCKeditor->BasePath = ‘/FCKeditor/’;
// $oFCKeditor->Value = $row[‘Body’];
// $oFCKeditor->ToolbarSet = ‘ALADef’;
// $oFCKeditor->Create() ;
}
echo " ";
// Deleted
$DeletedForm = “<select size=“1” name=“deleted”>”;
$DeletedForm .= “<option $dDeletedN value=“N”>Non”;
$DeletedForm .= “<option $dDeletedY value=“O”>Oui”;
$DeletedForm .= “”;
if ($view != true) {
puttblrowdefinputtxt(“Effacer :”,$DeletedForm);
echo "<tr>";
echo "<td class=\"darkstd\" align=\"right\" colspan=\"2\"><font size=\"2\">";
echo '<input type="hidden" name="save" value="Sauvegarder">';
echo '<input type="submit" value="Sauvegarder">';
echo "</font></td>";
echo "</tr>";
}
echo '</table>';
echo '</form>';
if ($view == true && ($row['CreatedBy'] == $UserInfo["Usager_id"] || $UserInfo["Admin"] == 'O')) {
echo '<a href="'.$config["index"].'?part=postedispo&choix=view&id='.$row['id'].'&mode=edit">';
echo 'modifier';
echo '</a>';
}
}
function posteList() {
global $config, $connection;
$SQL = 'SELECT * FROM PosteDisponible_db WHERE Deleted = "N" AND DATE_ADD(NOW(), INTERVAL 31 DAY) > CreateDate ORDER BY Type';
$query = mysql_db_query($config["DB"], $SQL, $connection);
$curType = '';
echo '<table border=0>';
while($row = mysql_fetch_array($query)) {
if ($curType != $row['Type']) {
$curType = $row['Type'];
echo '<tr>';
echo '<td>';
if ($curType == 'E') {
echo "<B>Employé disponible</B>";
} else {
echo "<BR><B>Poste disponible</B>";
}
echo '</td>';
echo '</tr>';
}
echo '<tr>';
echo '<td>';
echo '<a href="'.$config["index"].'?part=postedispo&choix=view&id='.$row['id'].'&mode=view">';
echo $row['Title'];
echo '</a> ';
echo '</td>';
echo '</tr>';
}
echo '</table>';
}
//
//
//Choose a file to upload:
//
//
?>