Jump to content

Form Submission


SUNIL16

Recommended Posts

Hi Friends,

 

i am doing career related project in my institute..

 

i am making one forum where you can post some source codes of .net, java, php, html etc..

 

this is how i created my database table.

mysql_query("CREATE TABLE `questions` (
`qid` int(5) NOT NULL auto_increment,
`question` varchar(255) NOT NULL default'0',
`answer` longtext NOT NULL,
`name` varchar(65) NOT NULL default '0',
`datetime` varchar(25) NOT NULL default'0',
`view` int(5) NOT NULL default '0',
`reply` int(4) NOT NULL default '0',
PRIMARY KEY (`qid`)
) TYPE=MyISAM AUTO_INCREMENT=1 ");

 

now if u send any text its taking. but if i send some code of php or html or some other its  not showing correctly.

 

so i want to know how to ignore this code while inserting in database. means i want to store as it is and retrieve back as it is.

 

means if some one sends a html code like this in form

<table class="main_text" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">

or if some one sends php code in form like this

<?php
echo"sunilkumar";
?>

it has to store as it is and retrieve back same.

please help.

Link to comment
Share on other sites

you might consider to use well

 

htmlentities($str);

 

ex:

<?php
$str='<table class="main_text" border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">';

print htmlentities($str);
?>

tell me.. what the output !

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.