[PHP-DB] Formatting a form box

2006-01-12 Thread Alex Major
Hi there, 
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they have
to put  in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards, 
Alex.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Formatting a form box

2006-01-12 Thread Bastien Koert

use the nl2br() function to convert the newlines to 


bastien


From: Alex Major <[EMAIL PROTECTED]>
To: 
Subject: [PHP-DB] Formatting a form box
Date: Thu, 12 Jan 2006 16:33:01 +

Hi there,
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they 
have

to put  in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards,
Alex.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Formatting a form box

2006-01-12 Thread Miguel Guirao


One approach is to ask the user to input a text delimiter, like a "@", for
example, in every point where there should be a new line or paragraph.
Then, you should parse the text, and at every point you find a "@", tu place
a "" or "" or any other HTML tag that best suits your need!!

This is just one solution, but I'm pretty sure there others!!

Mike Guirao

-Original Message-
From: Alex Major [mailto:[EMAIL PROTECTED]
Sent: Jueves, 12 de Enero de 2006 10:33 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] Formatting a form box


Hi there,
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they have
to put  in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards,
Alex.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Formatting a form box

2006-01-12 Thread tg-php
What? Nobody said "This has nothing to do with PHP and databases?"  Sheesh... 
someone must be sleeping. :)  Ok, so it sorta does relate..

But yeah... no2br() will do it for you.  Textarea input types DO send a newline 
and/or carriage return (didn't test and might be system specific), so if you 
just take your form $_POST data and use nl2br() before you store it in the 
database (or probably after... should be able to store a newline/carriage 
return in the database) it should produce the results you desire.

test.php:








Look at the source code after you submit if you have any doubts/questions.

-TG

= = = Original message = = =

use the nl2br() function to convert the newlines to 


bastien

>From: Alex Major <[EMAIL PROTECTED]>
>To: 
>Subject: [PHP-DB] Formatting a form box
>Date: Thu, 12 Jan 2006 16:33:01 +
>
>Hi there,
>On one of my forms, there is a section where users can put images etc..and
>then it is displayed on my php pages. My question is how do I make it so
>that the html formatting is automatically done. For example when someone is
>typing something, and wants to start a new paragraph although they press
>return when typing when the data is displayed from the MySQL database on a
>website it's just continuous text. For it to start a new paragraph they 
>have
>to put  in when they are typing in this box. They do not know all the
>html formatting codes, and so I need someway of making so that it is easy
>for them to have formatted text without doing all the html.
>Also things like changing colours, bold, italic and things would be good.
>Something like on forums, where when you enter a new post you have all the
>formatting options.
>
>Hope this makes sense,
>Regards,
>Alex.


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting a form box

2006-01-12 Thread El Bekko

Miguel Guirao wrote:


One approach is to ask the user to input a text delimiter, like a "@", for
example, in every point where there should be a new line or paragraph.
Then, you should parse the text, and at every point you find a "@", tu place
a "" or "" or any other HTML tag that best suits your need!!

This is just one solution, but I'm pretty sure there others!!

Mike Guirao

-Original Message-
From: Alex Major [mailto:[EMAIL PROTECTED]
Sent: Jueves, 12 de Enero de 2006 10:33 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] Formatting a form box


Hi there,
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they have
to put  in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards,
Alex.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.


The nl2br() function is way better because you don't change email adressess.

And for the colours and stuff... just put a small note on the bottom of 
your post page what HTML tags they are allowed to use.


Greets, El Bekko

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting a form box

2006-01-12 Thread Alex Major
Thanks for the suggestions, the nl2br has been a common suggestion and think
that I have found more of what the problem is. (And it is kinda php specific
cause its php pages). Basically its not displaying it correctly on the page,
the text in the database is now being stored correctly (with lines / breaks
where they are supposed to be) but for some reason when that info is then
pulled from the database, the lines get removed.
Any ideas why?


On 12/1/06 17:41, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> What? Nobody said "This has nothing to do with PHP and databases?"  Sheesh...
> someone must be sleeping. :)  Ok, so it sorta does relate..
> 
> But yeah... no2br() will do it for you.  Textarea input types DO send a
> newline and/or carriage return (didn't test and might be system specific), so
> if you just take your form $_POST data and use nl2br() before you store it in
> the database (or probably after... should be able to store a newline/carriage
> return in the database) it should produce the results you desire.
> 
> test.php:
> 
> 
> 
> 
> 
> 
>  
> if (isset($_POST['testarea'])) {
> 
>   echo nl2br($_POST['testarea']);
> 
> }
> ?>
> 
> Look at the source code after you submit if you have any doubts/questions.
> 
> -TG
> 
> = = = Original message = = =
> 
> use the nl2br() function to convert the newlines to 
> 
> 
> bastien
> 
>> From: Alex Major <[EMAIL PROTECTED]>
>> To: 
>> Subject: [PHP-DB] Formatting a form box
>> Date: Thu, 12 Jan 2006 16:33:01 +
>> 
>> Hi there,
>> On one of my forms, there is a section where users can put images etc..and
>> then it is displayed on my php pages. My question is how do I make it so
>> that the html formatting is automatically done. For example when someone is
>> typing something, and wants to start a new paragraph although they press
>> return when typing when the data is displayed from the MySQL database on a
>> website it's just continuous text. For it to start a new paragraph they
>> have
>> to put  in when they are typing in this box. They do not know all the
>> html formatting codes, and so I need someway of making so that it is easy
>> for them to have formatted text without doing all the html.
>> Also things like changing colours, bold, italic and things would be good.
>> Something like on forums, where when you enter a new post you have all the
>> formatting options.
>> 
>> Hope this makes sense,
>> Regards,
>> Alex.
> 
> 
> ___
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Formatting a form box

2006-01-12 Thread Bastien Koert

show the code bit relevant to the nl2br issue and conversion

bastien



From: Alex Major <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>,
Subject: Re: [PHP-DB] Formatting a form box
Date: Thu, 12 Jan 2006 19:42:33 +

Thanks for the suggestions, the nl2br has been a common suggestion and 
think
that I have found more of what the problem is. (And it is kinda php 
specific
cause its php pages). Basically its not displaying it correctly on the 
page,

the text in the database is now being stored correctly (with lines / breaks
where they are supposed to be) but for some reason when that info is then
pulled from the database, the lines get removed.
Any ideas why?


On 12/1/06 17:41, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> What? Nobody said "This has nothing to do with PHP and databases?"  
Sheesh...

> someone must be sleeping. :)  Ok, so it sorta does relate..
>
> But yeah... no2br() will do it for you.  Textarea input types DO send a
> newline and/or carriage return (didn't test and might be system 
specific), so
> if you just take your form $_POST data and use nl2br() before you store 
it in
> the database (or probably after... should be able to store a 
newline/carriage

> return in the database) it should produce the results you desire.
>
> test.php:
>
> 
> 
> 
> 
> 
> 
> if (isset($_POST['testarea'])) {
>
>   echo nl2br($_POST['testarea']);
>
> }
> ?>
>
> Look at the source code after you submit if you have any 
doubts/questions.

>
> -TG
>
> = = = Original message = = =
>
> use the nl2br() function to convert the newlines to 
>
>
> bastien
>
>> From: Alex Major <[EMAIL PROTECTED]>
>> To: 
>> Subject: [PHP-DB] Formatting a form box
>> Date: Thu, 12 Jan 2006 16:33:01 +
>>
>> Hi there,
>> On one of my forms, there is a section where users can put images 
etc..and
>> then it is displayed on my php pages. My question is how do I make it 
so
>> that the html formatting is automatically done. For example when 
someone is
>> typing something, and wants to start a new paragraph although they 
press
>> return when typing when the data is displayed from the MySQL database 
on a

>> website it's just continuous text. For it to start a new paragraph they
>> have
>> to put  in when they are typing in this box. They do not know all 
the
>> html formatting codes, and so I need someway of making so that it is 
easy

>> for them to have formatted text without doing all the html.
>> Also things like changing colours, bold, italic and things would be 
good.
>> Something like on forums, where when you enter a new post you have all 
the

>> formatting options.
>>
>> Hope this makes sense,
>> Regards,
>> Alex.
>
>
> ___
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Table sorting problem

2006-01-12 Thread Charles River

I am a novice in both PHP and MySQL, otherwise I would be able to do
this myself. :-)

A non-profit I assist has a table 
() that is

displayed by a simple PHP script. That was fine last year, but now we
have some new officers and some new board members and I have no idea
how to change the script so that "Officers and Members" table is 
presented officers first (Pres, Vice-pres, Sec and Treas) and then an 
alpha listing of board members who are not officers.


The existing script looks like this:

";
echo "\n";
echo "Office\n";
echo "Name\n";
echo "Address\n";
echo "Phones\n";
echo "Church\n";
echo "Email\n";
echo "TermEnds\n";
echo "\n";

  while ( $row = mysql_fetch_array($result,MYSQL_ASSOC) )
  {
echo "\n";

if ($row['Office'] == " ") {
echo " \n";
} else {
echo "{$row['Office']}\n";
}
echo "{$row['Name']}\n";
echo "{$row['Address']}\n";
echo "{$row['Phone']}\n";
if ($row['Church'] == "") {
echo " \n";
} else {
echo "{$row['Church']}\n";
}
if ($row['Email'] == "") {
echo " \n";
} else {
echo "{$row['Email']}\n";
}
echo "{$row['Term']}\n";
echo "\n";
  }
echo "\n";
?>

Can some kind soul bang out the code I need? Thanks.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Table sorting problem

2006-01-12 Thread Bastien Koert

are the officers id'ed by some column? if so then add

ORDER by COLUMN_NAME

bastien



From: Charles River <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Table sorting problem
Date: Thu, 12 Jan 2006 16:51:29 -0500

I am a novice in both PHP and MySQL, otherwise I would be able to do
this myself. :-)

A non-profit I assist has a table () 
that is

displayed by a simple PHP script. That was fine last year, but now we
have some new officers and some new board members and I have no idea
how to change the script so that "Officers and Members" table is presented 
officers first (Pres, Vice-pres, Sec and Treas) and then an alpha listing 
of board members who are not officers.


The existing script looks like this:

";
echo "\n";
echo "Office\n";
echo "Name\n";
echo "Address\n";
echo "Phones\n";
echo "Church\n";
echo "Email\n";
echo "TermEnds\n";
echo "\n";

  while ( $row = mysql_fetch_array($result,MYSQL_ASSOC) )
  {
echo "\n";

if ($row['Office'] == " ") {
echo " \n";
} else {
echo "{$row['Office']}\n";
}
echo "{$row['Name']}\n";
echo "{$row['Address']}\n";
echo "{$row['Phone']}\n";
if ($row['Church'] == "") {
echo " \n";
} else {
echo "{$row['Church']}\n";
}
if ($row['Email'] == "") {
echo " \n";
} else {
echo "{$row['Email']}\n";
}
echo "{$row['Term']}\n";
echo "\n";
  }
echo "\n";
?>

Can some kind soul bang out the code I need? Thanks.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Table sorting problem

2006-01-12 Thread Miles Thompson

At 05:51 PM 1/12/2006, Charles River wrote:


I am a novice in both PHP and MySQL, otherwise I would be able to do
this myself. :-)

A non-profit I assist has a table () 
that is

displayed by a simple PHP script. That was fine last year, but now we
have some new officers and some new board members and I have no idea
how to change the script so that "Officers and Members" table is presented 
officers first (Pres, Vice-pres, Sec and Treas) and then an alpha listing 
of board members who are not officers.


The existing script looks like this:

";
echo "\n";
echo "Office\n";
echo "Name\n";
echo "Address\n";
echo "Phones\n";
echo "Church\n";
echo "Email\n";
echo "TermEnds\n";
echo "\n";

  while ( $row = mysql_fetch_array($result,MYSQL_ASSOC) )
  {
echo "\n";

if ($row['Office'] == " ") {
echo " \n";
} else {
echo "{$row['Office']}\n";
}
echo "{$row['Name']}\n";
echo "{$row['Address']}\n";
echo "{$row['Phone']}\n";
if ($row['Church'] == "") {
echo " \n";
} else {
echo "{$row['Church']}\n";
}
if ($row['Email'] == "") {
echo " \n";
} else {
echo "{$row['Email']}\n";
}
echo "{$row['Term']}\n";
echo "\n";
  }
echo "\n";
?>

Can some kind soul bang out the code I need? Thanks.


I'd cheat and add a numeric field, let's call it num_rank, ranking the 
offices in the order you want them displayed, e.g.


President   10
Vice-President  20
.
.
.
Board Member50
Board Member50
Board Member50

and change the query to
SELECT * from members order by num_rank, last_name
which would provide officers and board member in the order you want them, 
automatically sorted by name.


Incidentally, why do you have a separate table for officers and directors? 
Maybe the answer is "because it was cheap and easy",

but is there a separate listing for all members who are not on the Board?

In that case, you would be better off with two tables:

1. Add a logical lBoardMbr field to your general list of members, and this 
general list of members also has to have a unique primary key. MySQL will 
do that for you with an autoincrement field, with a table  type of MyISAM. 
That table type ensures no re-use of deleted keys.


2. Your BoardMbr table then consists of fields like this:
nMbrId - primary key of the person in the general list
cOffice - text, "President", "Vice-President"  "Board Member" etc.
num_rank - as discussed above
cTerm - text field describing term.

When a member becomes an officer you do four things:
a) set the lBoardMbr field to true in the general table
b) enter the member's primary key value in nMbrId field in 
BoardMbr table

c) enter correct value cTerm in the same table
d) set the lBoardMbr field to false in the general members table 
for those members who are leaving the board.


The query to select the officers and directors would then change to
SELECT general.nMbrdID as nGenId, BoardMbr.nMbrID as nBrdId, * 
from general, BoardMbr

WHERE nGenID = nBrdID
AND lBoardMbr != 0
ORDER BY num_rank, last_name

Advantage? Data more closely approaches 3rd normal form, no redundancy, no 
errors when retyping, etc.


Long answer - hope it's been helpful.

Regards - Miles Thompson


PS If this is pedantic, and you know how to do all this stuff, pls forgive.
PPS Note I've assumed you have first_name and last_name fields /mt 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.371 / Virus Database: 267.14.17/227 - Release Date: 1/11/2006

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Table sorting problem

2006-01-12 Thread Gerry Danen
On 1/12/06, Miles Thompson <[EMAIL PROTECTED]> wrote:

> I'd cheat and add a numeric field, let's call it num_rank, ranking the
> offices in the order you want them displayed, e.g.
>
> President   10
> Vice-President  20
> .
> .
> .
> Board Member50
> Board Member50
> Board Member50
>
> and change the query to
>  SELECT * from members order by num_rank, last_name
> which would provide officers and board member in the order you want them,
> automatically sorted by name.


This is exactly how I implemented this page:
http://www.arls-lilies.org/h/board.php

--
Gerry
http://portal.danen.org/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php