Jump to content

Recommended Posts

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.

I have attached the page with the defective coding

Both the Information and Description fields are mediumblob in the SQL table.

Any help would be greatly appreciated

Thanks

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/242095-text-area-empties/
Share on other sites

Just the top of my head (didn't look the code) your mysql field names has nothing to do with that what your textarea field is named. If you give textarea a name="Information" then the textarea content will be in variable $_REQUEST['Information'] and not in $_REQUEST['information'] just like mjdamato mentioned. From there you can process, rename or do whatever with the data and save it to the database. Does not matter if textarea has name="Bunny", then the content will be in $_REQUEST['Bunny']. And your db structure is not relevant to that.

Link to comment
https://forums.phpfreaks.com/topic/242095-text-area-empties/#findComment-1243387
Share on other sites

I did modify the code everywhere on the page to have Information just like the table, the part of the code you are referencing now looks like this:

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'] . '")';

 

Am I not understanding?

thank you for your help

Link to comment
https://forums.phpfreaks.com/topic/242095-text-area-empties/#findComment-1243390
Share on other sites

You can put the echo $_REQUEST; in the top of the page for example. It will output the posted data for you when you submit. Then you can see the variables and values that are submitted and see if theres something missing and start looking further why they are missing.

 

And echo $SQL; before running query. Then you see how your SQL queries are formed. You can then inspect them to see if they are correct.

Link to comment
https://forums.phpfreaks.com/topic/242095-text-area-empties/#findComment-1243399
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.