小弟初學者,問個有關問題,高手幫忙啊

來源:互聯網
上載者:User
小弟菜鳥,問個問題,高手幫忙啊!!!!!!
小弟欲做一個 點擊表格裡面的資料後就可以線上編輯。編輯完以後按斷行符號 直接把剛修改的資料入庫!!

HTML代碼:














$sql="select * from news";$result=mysql_query($sql);while($rs=mysql_fetch_array($result)){?> } ?>






JQUERY代碼:

$(function(){
var numTD = $("tr td:even");
numTD.click(function(){
var input=$("");

input.css("border-width","0");


var tdobj=$(this);
input.width(tdobj.width());


input.val(tdobj.html());
tdobj.html("");
input.appendTo(tdobj);
input.get(0).select();
input.click(function(){
return false ;
});

input.keyup(function(event){
var keycode = event.which;
var inputtext = $(this).val();

if (keycode == 13){
$.get("http://127.0.0.1:8080//100/jquery/insert.php?name="+inputtext);

}

if (keycode ==27)
{
tdobj.html(text);
}

});
});

});




PHP代碼

$name=$_GET["id"];
$name=$_GET["name"];
$title=$_GET["title"]
$sql="update news set name='$name' where id='$id'";

mysql_query($sql);


運行效果,點擊後可以編輯。但斷行符號不能入庫。。請高手解決!!!!謝謝了!!

------解決方案--------------------
$name=$_GET["id"]; is this a typo or your intending?
I can't find the place where you input your ID field,

$sql="update news set name='$name' where id='$id'";
but request here somehow.
------解決方案--------------------
$name=$_GET["id"];//連結中沒有id
$name=$_GET["name"];
$title=$_GET["title"]//連結中沒有title
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.