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
https://forums.phpfreaks.com/topic/142351-form-submission/
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
https://forums.phpfreaks.com/topic/142351-form-submission/#findComment-745859
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.