473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Updating a database via a textarea

7
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_textWelcome = $_POST[text_welcome]; // PROBLEM HERE

text_welcome being the name/id of the textarea.

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

just for further information but this query works. Like I said if i change the PHP problem to: $post_textWelcome ="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 2438
Markus
6,050 Expert 4TB
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_single_quotes'];
[/php]
Dec 30 '07 #2
OmniX
7
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 Expert 4TB
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
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
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
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...
16
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...
3
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...
3
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
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...
3
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...
5
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...
1
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.