473,511 Members | 16,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help please

Two things I am not sure about, and would appreciate an answer to.

1) This may be simple. When creating a form to insert data into a table, I
seem to loose all the returns when data is inputted. I use the following
script:

page1.php:
<form action="page2.php">
<textarea name="textbox"></textarea>
<input type="submit">
</form>

page2.php:
<?php
include("dblogin.php"); // Loads database password, username and opens
database line.
$query = "INSERT INTO table1 (column1) VALUES ('$textbox')";
$result = mysql_query($query);
?>

All the carrige returns dissappear, meaning i have to use <br> or the <p>
tags, but this is not possible for users of a site to have to type in <br>
instead of return. Any ideas?

2) Even easier. Does anyone know where there is a good tutorial for creating
..png images automatically from data.

Many thanks in advance
Shaun
http://www.shaund.com - My Homepage
http://www.green-cabbage.co.uk - My Plymouth Argyle Site (UK Soccer Team)
Jul 17 '05 #1
3 3642
You may need to catch the variable from the textbox if your php.ini config
has Global variable disabled which is the best option for security issues.

<?php
$textbox = $_POST["textbox"];
include("dblogin.php"); // Loads database password, username and opens
database line.
$query = "INSERT INTO table1 (column1) VALUES ('$textbox')";
$result = mysql_query($query);
?>

2nd: you have to replace \n (return) by <br> with the function

str_replace("\n", "<br>", $textarea);

"Shaun Demellweek" <sh***@shaund.com> a écrit dans le message de
news:bk**********@newsg2.svr.pol.co.uk...
Two things I am not sure about, and would appreciate an answer to.

1) This may be simple. When creating a form to insert data into a table, I
seem to loose all the returns when data is inputted. I use the following
script:

page1.php:
<form action="page2.php">
<textarea name="textbox"></textarea>
<input type="submit">
</form>

page2.php:
<?php
include("dblogin.php"); // Loads database password, username and opens
database line.
$query = "INSERT INTO table1 (column1) VALUES ('$textbox')";
$result = mysql_query($query);
?>

All the carrige returns dissappear, meaning i have to use <br> or the <p>
tags, but this is not possible for users of a site to have to type in <br>
instead of return. Any ideas?

2) Even easier. Does anyone know where there is a good tutorial for creating .png images automatically from data.

Many thanks in advance
Shaun
http://www.shaund.com - My Homepage
http://www.green-cabbage.co.uk - My Plymouth Argyle Site (UK Soccer Team)

Jul 17 '05 #2
I noticed that Message-ID: <8A*******************@news20.bellglobal.com>
from Savut contained the following:
2nd: you have to replace \n (return) by <br> with the function

str_replace("\n", "<br>", $textarea);


or use the new line to <br> function

nltobr($textarea);

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #3
sam
"Shaun Demellweek" <sh***@shaund.com> wrote in message
news:bk**********@newsg2.svr.pol.co.uk...
Two things I am not sure about, and would appreciate an answer to.

1) This may be simple. When creating a form to insert data into a table, I
seem to loose all the returns when data is inputted. I use the following
script:

page1.php:
<form action="page2.php">
<textarea name="textbox"></textarea>
<input type="submit">
</form>

page2.php:
<?php
include("dblogin.php"); // Loads database password, username and opens
database line.
$query = "INSERT INTO table1 (column1) VALUES ('$textbox')";
$result = mysql_query($query);
?>

All the carrige returns dissappear, meaning i have to use <br> or the <p>
tags, but this is not possible for users of a site to have to type in <br>
instead of return. Any ideas?

$textbox = nl2br($textbox);

This way you replace carrige returns with <br>'s
2) Even easier. Does anyone know where there is a good tutorial for creating .png images automatically from data.

Many thanks in advance
Shaun
http://www.shaund.com - My Homepage
http://www.green-cabbage.co.uk - My Plymouth Argyle Site (UK Soccer Team)

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3256
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
1
1917
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
0
1680
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
12
2095
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem ...
7
3570
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
5
2964
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
17
2011
by: JT | last post by:
Help me the following C++ question: Write a program to help a local bookshop automate its billing system. The program should do the following: (a)Let the user enter the ISBN, the system will...
7
3251
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that...
23
3232
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
2
1528
by: =?Utf-8?B?U2NvdHRSYWREZXY=?= | last post by:
I'm creating a doc project for my c# program. I've done this before but this time sonething is wrong. I build my doc project and is succeeds but when I open the help file, there is no documentation...
0
7245
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
7144
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
7356
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,...
0
7427
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
7512
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
5671
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,...
1
5069
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...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.