View unanswered posts | View active topics It is currently Sun Oct 02, 2022 12:07 am

Reply to topic  [ 2 posts ] 
 inserting html into mysql 
Author Message
Junior Member

Joined: Sun Aug 17, 2003 10:45 pm
Posts: 1
I am trying to create a page where I can insert a new recod into a table. The table has 2 fields, id and news. I have a submission page (news_add.html) that has the form action for news_add.php. I cannot get the news in my form page into my db (it contains HTML code). I can get it to work with simple text (if i just enter "test" into my form field, that gets inserted as "value="test">". SO, it would seem that everything is wired properly, but for some reason I cannot insert html code. I am doing something wrong, how can I do it right? I will paste the code from the two pages below. Thank you very much.

--code from news_add.html--
<form action="news_add.php" method="post">
<div align="center">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<td width="6%" valign="top">HTML</td>
<td width="94%"><textarea name="news" cols="100" rows="25" id="news"></textarea></td>

<input type="Submit" value="Add News">

--code from news_add.php--
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO news VALUES ('','$news')";


_end pasting_

Sun Aug 17, 2003 10:54 pm
Report this post
Junior Member

Joined: Sat May 10, 2003 1:39 pm
Posts: 37

$query = "INSERT INTO news VALUES (NULL,'$news')";


$query = "INSERT INTO news (news) VALUES ('$news')";

Don't try to put a value into the id field.


Tue Aug 19, 2003 12:44 pm
Report this post
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
© Copyright 2003-2008 The ultimate PHP Editor and PHP IDE site.