副文本框的內(nèi)容可以看做是字符串(包含標(biāo)簽)。
潮南網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián),潮南網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為潮南超過(guò)千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營(yíng)銷網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的潮南做網(wǎng)站的公司定做!
方式1:php接收到的值直接插入數(shù)據(jù)庫(kù)即可,在頁(yè)面上獲取數(shù)據(jù)時(shí)瀏覽器自動(dòng)翻譯html標(biāo)簽和css樣式的,不用做什么處理。
方式2:如果只想保存內(nèi)容不保存標(biāo)簽和樣式可以用php函數(shù) strip_tags() 過(guò)濾字符串中的 HTML 標(biāo)簽, 然后再插入數(shù)據(jù)庫(kù),這樣數(shù)據(jù)存放的少,不帶樣式。但是你用到副文本框的意義就沒有了。
你的意思不是很明白 ,歡迎追問
編輯器都自帶使用方法的。推薦使用TinyMCE這個(gè)編輯器 下面是具體案例的使用方法。獲取值得時(shí)候獲取id的值就可以
textarea id="contentform" rows="1" cols="1" style="width:580px;height:360px;" name="articlecontent"/textarea
!-- Load TinyMCE --
script type="text/javascript" src="tiny_mce/jquery.tinymce.js"/script
script type="text/javascript"
$().ready(function() {
$("#contentform").tinymce({
// Location of TinyMCE script
script_url : 'tiny_mce/tiny_mce.js',
// General options
theme : "advanced",
language : "zh",
width : "580",
height : "360",
add_unload_trigger : true,
plugins : "Ybrowser,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
// Theme options
theme_advanced_buttons1 : "undo,redo,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "forecolor,backcolor,del,ins,|,cut,copy,paste,pastetext,pasteword,|,outdent,indent,attribs,|,link,unlink,anchor,image,Ybrowser,media,cleanup,|,preview,code,fullscreen",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
relative_urls : false,
convert_urls :true,
remove_script_host : false
});
var formoptions = {
beforeSubmit: function() {
$("#submitbtn").val("正在處理...");
$("#submitbtn").attr("disabled","disabled");
},
beforeSerialize: function($form, options) {
tinyMCE.triggerSave();
},
success: function (msg) {
alert(msg);
if(msg == "文章添加成功!")
{
$("#sform").resetForm();
var now = new Date();
$("#pubdate").val(now.format("yyyy-mm-dd HH:MM:ss"));
}
$("#submitbtn").val("提交");
$("#submitbtn").attr("disabled","");
}
};
$("#sform").ajaxForm(formoptions);
$("#pubdate").datetimepicker({
showSecond: true,
timeFormat: 'hh:mm:ss',
hour:?php echo date('H');?,
minute:?php echo date('i');?,
second:?php echo date('s'); ?,
closeText:'完成',
currentText:'當(dāng)前時(shí)間'
});
});
/script
!-- /TinyMCE --
把文本框放在表單form里面提交就可以了。直接獲得文本框的值,要插入多條記錄,就用循環(huán)執(zhí)行你的那條數(shù)據(jù)sql語(yǔ)句咯
有$_GET 或者 $_POST
代碼如下 :
form action='' method='post'
文本框:input type='text' name='text'
input type='submit' value='提交',name='sub'
/form
?php
if(!empty($_POST['sub'])){
echo $_POST['text'];
}
?
如果是GET 就換成GET
可以使用POST也可以使用GET方式進(jìn)行傳遞,比如
form action="" method="post"
input type='text' name="username"
input type="submit"
/form
?php
if(isset($_POST['username']))
{
$username = $_POST['username'];
}
echo 'input type="text" value="$username"';
?
大體是這樣,但是這只是個(gè)樣板~~~
分享標(biāo)題:用php從編輯框獲取數(shù)據(jù),php獲取輸入框內(nèi)容
地址分享:http://chinadenli.net/article42/dsshshc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、電子商務(wù)、靜態(tài)網(wǎng)站、做網(wǎng)站、定制開發(fā)、營(yíng)銷型網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
移動(dòng)網(wǎng)站建設(shè)知識(shí)