forms and PHP

Code junkies hangout here

Moderators: ChriThor, LXF moderators

forms and PHP

Postby grogoreo » Sat May 14, 2005 3:27 pm


I'm trying to make a sort of CMS for a site, in PHP, and am working on the backend. What I want is when a user goes to edit or create a new item, such as a news item, they will not have to code any HTML, or not a lot. What I'm thinking of is something like this forums post submitting form. One of the main things I want is when a carrage return is entered in the form, it will add one in the submitted HTML code. I looked at the source of the phpBB forum and found a bit where I think may do it, something like stripslashes. The text will then be entered into a MySQL database.

I would love a Rich Edit type form like you would in Word or Hotmail etc but that may be a bit much.

Posts: 11
Joined: Tue Apr 12, 2005 6:46 pm

PHP & MySQL Web Development

Postby skecs » Sun May 15, 2005 8:13 am

The best book I know on this is PHP & MySQL Web Development by Luke Welling & Laura Thomson - I think it is up to 3rd Edition now. I have used the forums and other sections and they all work quite well.

Capter 26 (in 2nd Edition) is called "Building a Content Management System" which should make it easy for you.

Have you also considered using one of the Open Source CMS like Mambo, phpWebSite or PostNuke like the LXF web site?
Regards from
.... _
... (0)>
... / /\
.. / / .)
.. V_/_
Linux Powered!
Posts: 76
Joined: Fri Apr 22, 2005 9:22 am
Location: Bathurst, NSW Australia

RE: PHP & MySQL Web Development

Postby grogoreo » Mon May 16, 2005 3:44 pm

Thanks skecs. I'll look into getting that book. I didn't want to use a CMS allready made as with a bespoken one I will learn on the way and also I've found that the design of the page is hindered and can not be what I really like, as you have to use a template or something.

Thanks again,
Posts: 11
Joined: Tue Apr 12, 2005 6:46 pm

RE: PHP & MySQL Web Development

Postby Gordon » Mon May 16, 2005 7:57 pm

Hi Skecs, neat sig :shock:
Violence is the last refuge of the incompetent
User avatar
LXF regular
Posts: 210
Joined: Thu Apr 07, 2005 5:01 pm
Location: Bradford, West Yorkshire

RE: PHP & MySQL Web Development

Postby gizard » Wed May 18, 2005 4:36 pm

with most thing, they take a while to code. Think about creating an object that gets passed a string and replaces \r with <br />
Also have a look at:
and to get a look at whats possible.

You can also simply enter the data into a database and print out to the right sections. I.e. Header, body.
and in the body, insert the <pre> </pre> tags. Ugly but works if your after a simple solution.
Gizard GBDesign - Data driven ERP web solutions for SME
Posts: 5
Joined: Wed Apr 13, 2005 5:24 pm


Postby kpzani » Thu Jun 09, 2005 8:58 pm

First thing

you can convert enters in a text field to <br>s with nl2br($_POST["textfield"]);

next. addslashes will escape any funny quotes either " or ' in the text

htmlspecialchars will convert & to &amp; and " to &quot; etc.

for the gui editor you can build your own there's info on the mozilla site ... ex_en.html

if you are going to be using php then you are welcome to the source code from my internal CMS, if you're interested email me
and i'll give you the url plus a temp username / password for a demo, if you like it then i'll make a copy minus usernames and passwords.

good luck

Posts: 9
Joined: Thu Jun 09, 2005 8:52 pm

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests