Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
| Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP 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 2nd, 2003, 02:09 PM
Authorized User
 
Join Date: Jun 2003
Location: San Jose, CA, USA.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Editing MySQL data from a PHP form

Ok, here's a strange one. I have some HTML code in a database. A lot of which is things like > or <. They are code samples for scripts I use. Here's the issue:

When I am using PHPMyADMIN and I edit the data, I get the &gt;'s and the &lt; just fine. However, if I create my own PHP form to edit the data, my page converts all of the &gt;'s and &lt;'s into their respective < or >.

How can I make sure that I am getting the &gt; or &lt; from the database in my form? Any ideas?

----------
~cmiller
__________________
----------
~cmiller
 
Old September 2nd, 2003, 02:21 PM
Authorized User
 
Join Date: Jun 2003
Location: San Jose, CA, USA.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

UPDATE***

Ok, here's what I figured out is happening in PHPMyADMIN. It is converting &lt; into &amp;lt; I guess I should just run a convert on & into &amp; huh? Does this sound right?


----------
~cmiller
 
Old September 2nd, 2003, 05:11 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah -- htmlentities() and/or htmlspecialchars() should do it for you.


Take care,

Nik
http://www.bigaction.org/




Similar Threads
Thread Thread Starter Forum Replies Last Post
Php transfering data to mysql Gaurava PHP How-To 2 January 5th, 2008 07:33 AM
Problem with editing my cell data in PHP. changusee2k Pro PHP 0 March 15th, 2006 03:57 AM
form php mysql masgas PHP Databases 3 February 12th, 2006 07:34 PM
Storing form array data to MySQL using PHP osemollie Beginning PHP 0 February 2nd, 2006 07:32 AM
How to script search form in PHP/MYSQL javabeans PHP How-To 0 January 12th, 2004 03:53 AM





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