473,394 Members | 1,740 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,394 software developers and data experts.

Storing variables (numbers) inside a text area and into db

i have code in a text area , i want the user to enter a number (units of alcohol )
and post the number to a mysql database , i want to store the number only and inside the drink () units . ie i want to put the code that reads from the brackets and insterts into a php script which stores the value in a database

How is this done????

please help &much apprieciated ,
laz
Code below
[php]
<td align="left" valign="middle"><table width="365" height="61" border="1">
<tr>
<td width="182"><textarea name="drink_unit" id="drink_unit">I drink () units of alcohol week</textarea></td>
<td width="167">for unit information please click here</td>
</tr>
</table></td>
</tr>[/php]
Mar 19 '08 #1
4 1727
ronverdonk
4,258 Expert 4TB
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Mar 19 '08 #2
ronverdonk
4,258 Expert 4TB
You enclose the textarea input field in a <form>. You also include a submit button in that form. When the uset submits the form, it is submitted to the script you define in the form statement.
In that 'catching' script you retrieve the value from the $_POST (or $_GET) array, make a connection to the db and insert the value in an MySQL INSERT statement.

That's it.

The following is a link to a tutorial on making a html form and inserting the data into the database HERE
Do that tutorial, write the code yourself and come back when you have problems.

Ronald
Mar 19 '08 #3
Markus
6,050 Expert 4TB
You enclose the textarea input field in a <form>. You also include a submit button in that form. When the uset submits the form, it is submitted to the script you define in the form statement.
In that 'catching' script you retrieve the value from the $_POST (or $_GET) array, make a connection to the db and insert the value in an MySQL INSERT statement.

That's it.

The following is a link to a tutorial on making a html form and inserting the data into the database HERE
Do that tutorial, write the code yourself and come back when you have problems.

Ronald
I think he's asking for a way to retrieve what the user inputs BETWEEN the brackets.
I.e, i drink (more than mary does) in a week ;
db-> "more than mary does" ;

Can't lend a hand though, im off to bed!

Regards.
Mar 19 '08 #4
ronverdonk
4,258 Expert 4TB
Thanks marcusn00b!

My previous post still stands, only you have to make the statement like this
Expand|Select|Wrap|Line Numbers
  1. <td width="182">I drink <input type="text" name="drink_unit" style="width:20px;" /> units of alcohol per week</td>
.
You still have to submit it to a receiving script and catch the content of $_POST['drink_unit'] (or from the $_GET['drink_unit'] depending on the method used to submit the form.)

Ronald
Mar 19 '08 #5

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

Similar topics

2
by: Mike Wilcox | last post by:
I have the following two files used to insert data into a database. when meinsert.php is executed a blank record is inserted in the database as if the .php file is not receiving the variables. ...
3
by: Robert | last post by:
Hello, Can anyone help with this? On my online order form, I need to send a few variables to my credit-card processor. These variables are for non-secure customer comments, and will be sent...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
2
by: Mark Hannon | last post by:
I am trying to wrap my brain around storing form elements inside variables & arrays before I move on to a more complicated project. I created this simple example to experiment and as far as I can...
6
by: Clausfor | last post by:
Hello, I have a problem with restoring variables in the setjmp/longjmp functions: K&R2 for longjmp says: "Accessible objects have the same value they had when longjmp was called, except for...
4
by: Ben | last post by:
Apologies if this is te wrong place to post - I realise the question is pretty basic... I have a simple python script that parses a text file and extracts data from it. Currently this data is...
17
by: Stubert | last post by:
I have a training module db that stores information about employees and what training they have carried our or need to carry out. One table in this database stores what training needs to be carried...
0
by: Harch84 | last post by:
Hi guys need some serious help I have a PostgreSQL database full of bus routes and bus stops. I am drawing them out using perl and manipulating the data. What I need to be able to do is to compare...
6
KevinADC
by: KevinADC | last post by:
This snippet of code provides several examples of programming techniques that can be applied to most programs. using hashes to create unique results static variable recursive function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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...

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.