| | |
PHP Text-Area Help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2006
Posts: 5
Reputation:
Solved Threads: 0
Hey guys... Needed some help in PHP ..
Basically.. say.. I have 2 or more input fields and one text area.
Now, I want some sort of a php script that would use POST to extract submitted data from the inputfield1, inputfield2, and text-area.
The textarea is going to have numbers in each line .. say like..
123
133
124 .. etc
... Next.. is it possible to extract the information submitted above (field1, field2, and textarea) and form them in some sort of output box as such
field1 textarea field2
So.. say .. output would be something like:
field1 = username
textarea = serial number
field2 = command
result would be
sam 123 accept
dave 133 accept
nick 124 deny
etc etc
Is it possible?
Basically.. say.. I have 2 or more input fields and one text area.
Now, I want some sort of a php script that would use POST to extract submitted data from the inputfield1, inputfield2, and text-area.
The textarea is going to have numbers in each line .. say like..
123
133
124 .. etc
... Next.. is it possible to extract the information submitted above (field1, field2, and textarea) and form them in some sort of output box as such
field1 textarea field2
So.. say .. output would be something like:
field1 = username
textarea = serial number
field2 = command
result would be
sam 123 accept
dave 133 accept
nick 124 deny
etc etc
Is it possible?
•
•
Join Date: Nov 2007
Posts: 86
Reputation:
Solved Threads: 6
Lifetalk,
textarea has nothing to do with PHP, that's html. But, to answer your question, yes, it's possible to pretty much do anything.
I assume that if you are asking about php, you must have a clue as to how html forms work.
Well, in your html form action, all you must do is give the action the filename.ext of your processing php page, such as action='process.php' (and obviously the method='post' as this is your request).
Give each of your input fields "name attributes"
in our process.php page we will then need to refer to those names, so, let's say you have an input field name='serial_number' (no spaces please)... on your process.php page, you will need to say
test this out by adding below it
an echo
now, I wonder what kind of output box you are looking for. PHP (to my knowledge) does not have like a popup "alert" box like javascript does (unless I am mistaking on that one).
so, if you want submit to give you some sort of jump up on the screen and tell you the information, you are going to have to do a crazy mix of javascript with your php, which can get a tad bit messy, but I won't go into that unless you come back and say that is what you were looking for.
I know that it's hard to describe what you are looking to do (I have the same problem at times), but if you can attempt to be a little bit more clear I am sure someone (maybe even I) can help you.
Sage
textarea has nothing to do with PHP, that's html. But, to answer your question, yes, it's possible to pretty much do anything.
I assume that if you are asking about php, you must have a clue as to how html forms work.
Well, in your html form action, all you must do is give the action the filename.ext of your processing php page, such as action='process.php' (and obviously the method='post' as this is your request).
Give each of your input fields "name attributes"
in our process.php page we will then need to refer to those names, so, let's say you have an input field name='serial_number' (no spaces please)... on your process.php page, you will need to say
PHP Syntax (Toggle Plain Text)
<?PHP $serialNumber = $_POST['serial_number']; ?>
test this out by adding below it
an echo
PHP Syntax (Toggle Plain Text)
<?PHP $serialNumber = $_POST['serial_number']; echo $serialNumber; ?>
now, I wonder what kind of output box you are looking for. PHP (to my knowledge) does not have like a popup "alert" box like javascript does (unless I am mistaking on that one).
so, if you want submit to give you some sort of jump up on the screen and tell you the information, you are going to have to do a crazy mix of javascript with your php, which can get a tad bit messy, but I won't go into that unless you come back and say that is what you were looking for.
I know that it's hard to describe what you are looking to do (I have the same problem at times), but if you can attempt to be a little bit more clear I am sure someone (maybe even I) can help you.
Sage
•
•
Join Date: Dec 2006
Posts: 5
Reputation:
Solved Threads: 0
Sage,
Thanks a lot for your help.. I'll try the PHP POST stuff today and post my results here.
If necessary, I'll draw everything out in Photoshop and post screenshots here .. just to be more clear
Thanks again.
Basically.. My main question was..
How would I go about separating each line in a 'textarea' and then having one variable that would append each line to the other two constants (field1 and field2 are constant, while 'textarea' has more than 1 line).
So, each line from textarea needs to be separately 'echoed' with the constants (field1 and field2).

Not sure if you understand it now, but don't worry, I'll be posting screenshots once I give this a shot
Thanks a lot for your help.. I'll try the PHP POST stuff today and post my results here.
If necessary, I'll draw everything out in Photoshop and post screenshots here .. just to be more clear

Thanks again.
Basically.. My main question was..
How would I go about separating each line in a 'textarea' and then having one variable that would append each line to the other two constants (field1 and field2 are constant, while 'textarea' has more than 1 line).
So, each line from textarea needs to be separately 'echoed' with the constants (field1 and field2).

Not sure if you understand it now, but don't worry, I'll be posting screenshots once I give this a shot
•
•
Join Date: Dec 2006
Posts: 5
Reputation:
Solved Threads: 0
Anyway, I've got round to doing a bit of what I want to achieve.
Take a look here
http://www.clipgamers.com/test
The directory listing has 2 files as of now..
-start.php
-process.php
Here's the code for process.php
Basically, what I wanted was..
To keep the first two variables asked for (in start.php named primary and secondary) constant.
Then, take the input from the textarea named 'CIDR' and break each line.
Append the 'primary' and 'secondary' (which is constant) to each line of 'CIDR' and then echo the output. One in each line.
Not sure if you still get what I want.. but hopefully things should be much clearer.
I've got round to doing most of it... Keeping the first two constant (lol) .. but for some reason, I am unable to add a line break in the text area and it is echoed as one.. instead of multiple lines..
Any ideas now?
Take a look here
http://www.clipgamers.com/test
The directory listing has 2 files as of now..
-start.php
-process.php
Here's the code for process.php
PHP Syntax (Toggle Plain Text)
<?PHP $primary = $_POST['primary']; $secondary = $_POST['secondary']; $cidr = $_POST['cidr']; $cidr = str_replace("\n","\n",$cidr); ?> <HTML> <BODY> Meh... <br /> <?PHP $gen=$gen.$primary; $gen=$gen.$cidr; $gen=$gen.$secondary; ?> <br /><br /> <b> <?PHP echo "$gen"; ?> </b> <br /> And that's the end.. </body> </html>
Basically, what I wanted was..
To keep the first two variables asked for (in start.php named primary and secondary) constant.
Then, take the input from the textarea named 'CIDR' and break each line.
Append the 'primary' and 'secondary' (which is constant) to each line of 'CIDR' and then echo the output. One in each line.
Not sure if you still get what I want.. but hopefully things should be much clearer.
I've got round to doing most of it... Keeping the first two constant (lol) .. but for some reason, I am unable to add a line break in the text area and it is echoed as one.. instead of multiple lines..
Any ideas now?
Last edited by lifetalk; May 23rd, 2008 at 3:05 pm.
![]() |
Similar Threads
- Lyrics Script - Help me creating a submit.php to sumbit new lyrics (PHP)
- php mailto () fuction (PHP)
- store HTML is a text field in a table on a MySQL Database (MySQL)
- Formatting text area (PHP)
- limit text area words (PHP)
- Filtering My sql through Php using drop down menu and text field (PHP)
- Can a PHP website be edited by myself? (PHP)
- Database Design Advice (MySQL)
Other Threads in the PHP Forum
- Previous Thread: a php code sample
- Next Thread: Session problem
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner beneath binary broadband broken button cakephp checkbox class cms code compression countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html httppost image include insert integration ip javascript joomla limit link links login mail match md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion remote script search searchbox server session sessions sms smtp source space sql strip_tags survey syntax system table tutorial update upload url validator variable video virus votedown web website window.onbeforeunload=closeme; youtube





