473,789 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating a database via a textarea

7 New Member
I have a textarea that is used to view a specific database cell, which works fine. The problem is when I edited the text in that textarea and then use php + mysql to update that specific database cell it does not work. When I just change the name to a random string "abc" the database is updated but it takes 2 clicks to work or 2 refreshers. So I found the problem line in the code but dont know what to do:

PHP problem:
$post_textWelco me = $_POST[text_welcome]; // PROBLEM HERE

text_welcome being the name/id of the textarea.

MySQL query:
"UPDATE $table1 SET $primaryKey1 = '$post_textWelc ome' WHERE welcome = '1'";

just for further information but this query works. Like I said if i change the PHP problem to: $post_textWelco me ="abc";
updates the text fine, well if i can aid you any further let me know but im hoping that you can solve my problem =)

Thanks in advance, Regards X
Dec 30 '07 #1
5 2450
Markus
6,050 Recognized Expert Expert
Are you sure you're using POST to send the data?

Also, it's good practice to wrap array keys in single quotes..

i.e.

[php]
$something = $_POST['wrapped_with_s ingle_quotes'];
[/php]
Dec 30 '07 #2
OmniX
7 New Member
ya i have wrapped it in quotes ' ' and not it dosent work either way.
Something wrong with that line of code because I cannot understand why it works with a string variable and will not with a post.

What did you mean by am i using $_POST to send?

im using post to gather the information that is contained within the textarea to make it equal to the variable?

im a newbie at php and trying to learn everything off my own back and its very hard at times =( been on this problem for 3 days and cant find a solution. Maybe someone can give me a working example of a textarea that is used to to call text into the textarea and that same textarea is used to update that cell?

Thanks Again, Regards X
Dec 30 '07 #3
Markus
6,050 Recognized Expert Expert
First) The data submitted from the textarea has to come from a form and that form has to have a method - POST or GET. The code that you use to retrieve the data has to be respective to the method you use.

i.e. if you use a method=POST then you have to use $_POST to retrieve it.
Dec 30 '07 #4
OmniX
7 New Member
LOL!!!

Something is buggy or my code is just really bad.... lol

Thanks for the help man. Something weird happened, I had post previously to encrypt the sent message and nothing was happening. I change them both to get and the message was working and then i change them back to post and it works fine now. So why was it not working orginally? =(

So the only problem I face now is that somehow its storing and retreiving 2 different variables in the textarea. Eg. textarea loads with 123a and then I change that to 123b click the submit button and 123a appears. click the submit button again and 123b appears. Any Ideas?

Happy New Year people, thanks again, X ;)
Dec 31 '07 #5
OmniX
7 New Member
I just solved the problem, thanks for the help!

HAPPY NEW YEAR TO ALL!!!
Dec 31 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1792
by: Bob Kaku | last post by:
I'm trying to create a text editing and updating capability to help someone who wants to maintain content on a web page without having to know any HTML or use a web authoring tool and FTP'ng the contents. I've already created a screen whereby the person can create new content with a PHP program that inserts into a MySQL table. But, I'm having a little trouble in creating the edit/update functionality. Can somebody help me out? Thanks. ...
16
3501
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown list and checkbox so that they can make changes. I named these elements as arrays and wish to run an...
3
1219
by: Dot Net Daddy | last post by:
Hello, I have some textareas assigned some values which is taken from the database on page_load. Also there is an update button. But when I change the text and click the update button it does not work. Actually it works, but the text I type in the textarea is not recognized. It recognizes the assigned value on page_load, and updates the same thing over itself.
3
2120
by: bb nicole | last post by:
Below is my job post code, it cannot post into database... WHAT IS THE PROBLEM OF IT?? <?php session_start(); ob_start(); //connect to server and select database
1
1789
by: bb nicole | last post by:
Below is my interface for resume which need to post into database... I have did it all in one page and it already can send into database which the table name resume... But my letturer now want me to seperate it in to 4 pages( 1 page is for personnel particular, 1 page is for education, 1 page is for worl experience and so on). And it is need a next button to continue it, at last user need to click on post resume button and post to database....
3
1797
by: Spoogledrummer | last post by:
Hi it's me again, still working on the sam 5 minute problem so feeling kind of thick now. I've dumped the idea of using a textarea for now and am using a textbox instead but am struggling when it comes to updating the database, I've tried several different methods and the one I'm currently battling with is as follows: % set objconn=server.CreateObject("ADODB.connection") objconn.Mode=3 objconn.Open ("DSN=localserver; User ID=blah;...
5
7041
by: TechnoAtif | last post by:
Hi All..'mAtif..i've got stuck within checkboxes these days..i've got many input items like checkboxes,textarea and along with them there are many checkboxes...all the data except the checkbox's is comfortably getting entered into the database but the real problem is with the checkboxes..only one entry is being stored ...but i want to enter the multiple entries from the checkboxes to enter into the database...the form is a voting poll..and i...
1
1521
by: lilbadger25 | last post by:
I am trying to code a page that allows the user to edit the content that is drawn from the database. The fields show the correct data from the database, and you can type in the fields, but the database does not update when the "submit" button is clicked. It jumps to the events list page, as it should, but the information has not been changed. My code is as follows: Top of page <? if (array_key_exists('_submit_check', $_POST)) {...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9499
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10374
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10121
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4076
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.