Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
| Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 6th, 2006, 04:54 PM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default posting html code via a form php

I need to know how to allow users to input html code into a form and allow them to submit the code. I want to store it in a database for later use.

What happens now is when i input data and submit the form, all the html tags are gone so only non html text is present.

I guess i need to know how to disable stripping of html tags by php or whatever is doing it.

 
Old September 12th, 2006, 01:22 AM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There are two functions in PHP3/4/5 named
1.string strip_tags ( string str [, string allowable_tags] )
2.string htmlspecialchars ( string string [, int quote_style [, string charset]] )

If you use
$name = strip_tags("<b>Zia</b>") and insert into $name in Database, the output will be "Zia"
but
If you use
$name = htmlspecialchars("<b>Zia</b>") and insert into $name in Database, the output will be "<b>Zia</b>" means bold "Zia"

Please let me know whether it works.
Regards,
Zia





Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP code to insert values from HTML form to SQL se rbyamukama Pro JSP 3 January 29th, 2013 07:42 AM
register.php: clearing html form fields lamada BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 26th, 2004 01:25 PM
Posting message via HTTP to a PHP script ThaYoung1 Biztalk 0 February 9th, 2004 05:03 AM
HTML: <FORM> embedded in code valentino HTML Code Clinic 1 July 9th, 2003 10:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.