澳门新浦京8455com利用js调用后台php进行数据处理原码

主意已於方法,当中的地点也上得的,笔者只是把它消化后再度写了更周到的出来。公布出只是梦想越多的生手能中到部分西。倘诺你代有别的意能够留言,但勿行人身攻,作者是一菜只能出的西,每种老司机都有那般的长河。

1.guestbook.php html head script language=JavaScript !– !– var
hellotext=为了您的特级浏览效果请你使用IE4.0以上的本子和800*600分辨率
var thetext= var started=false var step=0 var times=1 function
welcometext() { times– if (times==0) { if (started==false) { started =
true; window.status = hellotext; setTimeout(anim(),1); } thetext =
hellotext; } } function showstatustext(txt) { thetext = txt;
setTimeout(welcometext(),4000) times++ } function anim() { step++ if
(step==7) {step=1} if (step==1) {window.status=’===’+thetext+’===’} if
(step==2) {window.status=’===’+thetext+’===’} if (step==3)
{window.status=’==’+thetext+’==’} if (step==4)
{window.status=’==’+thetext+’==’} if (step==5)
{window.status=’===’+thetext+’===’} if (step==6)
{window.status=’===’+thetext+’===’} setTimeout(anim(),200); } // —
welcometext(); function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+.location=’+selObj.options[selObj.selectedIndex].value+’卡塔尔;
if (restore卡塔尔 selObj.selectedIndex=0; } //– /script
title天地互联网留言版/title meta content=text/html; charset=gb2312 /head
style type=text/css !– a:link {font-size: 9pt; color: #FFFFFF} —
/style body ? $PAGESIZE=5; $db=mysql_connect(localhost,root,);
mysql_select_db(lyanban,$db); $result=mysql_query(SELECT * FROM
message order by date desc,$db); $rowcount=mysql_num_rows($result卡塔尔(قطر‎;
$PAGES=CEIL($rowcount/$PAGESIZE卡塔尔(قطر‎; if($rowcount==0卡塔尔(قطر‎ {echo 如今未曾留言!a
href=guestbook.htm款待您留言!/a;} if($rownum == State of Qatar { $rownum = 1; }
$AA=CEIL($rownum/5卡塔尔国; $i=0 ; echo TABLE WIDTH=100%tddiv font size=2
color=#000000B共有留言:$rowcount 条共:$PAGES 页right以往是第 $AA
页/right/B/font/div/td; echo hr size=1 color=#ccccffwidth=75%; while
($myrow=mysql_fetch_array($result)){ $i++;
if(($i=$rownum)&&($i$rownum+5)){ echo table width=75% border=1
cellspacing=0 cellpadding=0 bordercolordark=#FFFFFF
bordercolorlight=#000000 background=15.JPG; echo trtd width=15%div font
size=2 color=#FFFFFF姓 名/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[username]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF电子信箱/font/div/tdtd width=85%font size=2
color=#FFFFFFa href=mailto:$myrow[email]$myrow[email]/font/a/td/tr;
echo trtd width=15%div font size=2 color=#FFFFFF公司主页/font/div/tdtd
width=85%font size=2 color=#FFFFFFa href=$myrow[homepage]
target=_blank$myrow[homepage]/font/a/td/tr; echo trtd width=15%div
font size=2 color=#FFFFFF留言核心/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[topic]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF留言内容/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[content]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF留言时间/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[澳门新浦京8455com ,date]/font/td/tr; echo /tablehr size=1
color=#ccccffwidth=75%;} } echo table width=100%trtd width=87%;
#看清是还是不是有或 echo form name=hiddenform method=post
action=guestbook.php; echo div input type=hidden name=rownum value=;
echo input type=hidden name=rowcount value=$rowcount; #显示 if
($rownum=5) echo input type=submit value=
onclick=document.hiddenform.rownum.value=.($rownum-5).; #显示 if
($rownum+5=$rowcount) { echo input type=submit value=
onclick=document.hiddenform.rownum.value=.($rownum+5)./div; } echo
/form; echo /td; echo /tr; echo /table; echo table width=100% trtddiv
font color=#ffffff size=2a
href=guestbook.htm赶回继续发言/a/font/div/td/tr/table; ? /body /html
2.show.php3 ? $username = htmlspecialchars(ltrim(stripslashes
(trim($name卡塔尔国卡塔尔卡塔尔国卡塔尔;//本函式可去掉字串中的反斜线空格字元 $email =
htmlspecialchars(ltrim(stripslashes (trim($email卡塔尔国卡塔尔卡塔尔国卡塔尔; $homepage =
htmlspecialchars(ltrim(stripslashes (trim($homepageState of Qatar卡塔尔(قطر‎卡塔尔卡塔尔(قطر‎; $topic =
htmlspecialchars(ltrim(stripslashes (trim($topic卡塔尔卡塔尔国卡塔尔国State of Qatar; $content =
htmlspecialchars(ltrim(stripslashes (trim($content卡塔尔(قطر‎State of Qatar卡塔尔(قطر‎State of Qatar; //
$content=base64_encode($contentState of Qatar; //send email //if ($ok卡塔尔mail($email,$topic,$content卡塔尔国; if
(($username==State of Qataror($topic==State of Qataror(strlen($username卡塔尔20卡塔尔(قطر‎or(strlen($topic卡塔尔20State of Qatar卡塔尔{echo 请填入供给的花色或着非法顾客名!a
href=javascript:history.go(-1卡塔尔;重回/a; } //wrong email ? elseif
(($email!=)and(!eregi(^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$,$email卡塔尔卡塔尔(قطر‎卡塔尔(قطر‎{ echo 请你填写准确的 E-Mail 地址/pp a
href=javascript:history.go(-1卡塔尔(قطر‎;重返/a; } //wrong homepage ? elseif
(($homepage!=)and(!eregi(()+[0-9a-z-]+.([0-9a-z-]+.)+[a-z]{2,3}$,$homepageState of Qatar卡塔尔(قطر‎){echo 主页地址输入错误!a href=javascript:history.go(-1卡塔尔(قطر‎;再次来到/a;} else{
//联接数据库 mysql_connect(localhost,root,);
mysql_select_db(lyanban); $sql=select password from tb where
username=’$username’; $result=mysql_query($sql);
$nums=mysql_num_rows($result); if($nums!=1卡塔尔{ echo对不起!请先a
href=register.html注册/a!; } else{ //取得日期 YYYY-MM-DD HH:MM:SS
二〇〇四-01-01 00:00:00′ $t = date(Y.-.m.-.d. .H.:.i.:.s卡塔尔;
//将新客户插入数据库 mysql_query(insert into message values
(‘$username’,’$email’,’$homepage’,’$topic’,’$content’,’$t’)); echo div
font size=2 color=#000000感谢你留言!您的留言已成功步入,a
href=guestbook.php再次来到/a/font/div; } } ? 3.zhuc.php(注册程序卡塔尔(قطر‎ ?
mysql_connect(localhost,root,卡塔尔国 or die(不可能连接数据库,请重试卡塔尔;
mysql_select_db(lyanban卡塔尔(قطر‎ or die(不恐怕取舍数据库,请重试卡塔尔; $query=select
password from tb where username=’$username’;
$result=mysql_query($query); $numrows=mysql_num_rows($result);
if($numrows!=0卡塔尔国 {echo ‘原来就有人注册此名,请重新接纳名字!a
href=javascript:history.go(-1);返回/a’;} else {$query=insert into
tb(username,password) values(‘$username’,’$password’);
mysql_query($queryState of Qatar; echo ‘注册成功’; echo ‘A HREF=guestbook.htm
请登陆!/A’;} ? 以下是多少个配套的HTML: 1。留言网页 html head meta
content=text/html; charset=gb2312 meta name=GENERATOEscort content=Microsoft
FrontPage 4.0 meta name=ProgId content=FrontPage.Editor.Document
title天地网络留言版应接您留言!/title /head body bgcolor=#FFFFFF div
align=center center br font size=2天地网络留言版测验版/fontbr br form
method=post action=show.php3 table width=66% tr td width=四分之二 height=1
div align=center font size=2 您的高姓大名:/font/div /td td width=50%height=1 div align=center input type=text name=name size=20 /div /td /tr
tr td width=八分之四 height=1 div align=centerfont size=2
您的电子邮件地址:/font/div /td td width=二分之一 height=1 div align=center
input type=text name=email size=20 /div /td /tr tr td width=百分之五十 height=1
div align=centerfont size=2 您的厂商主页地址:/font/div /td td width=八分之四height=1 div align=center input type=text name=homepage size=20 value=
/div /td /tr tr td width=二分一 height=1 div align=center font
size=2留言大旨:/font/div /td td width=五成 height=1 valign=middle div
align=center input type=text name=topic size=20 /div /td /tr tr td
width=四分之二 height=1 div align=center font size=2留言剧情:/font/div /td
td width=百分之五十 height=1 div align=center /div /td /tr tr td width=100%colspan=2 height=66 p align=center textarea rows=10 name=content
cols=50/textarea /p /td /tr tr td width=百分之五十 height=18 div
align=center/div /td td width=二分之一 height=18 div align=center/div /td /tr
tr td width=六分之三 height=18 align=center p align=center input type=submit
value=公布留言 name=B1 /p /td td width=二分之一 height=18 align=center div
align=center input type=reset value=整身体重量写 name=B2 /div /td /tr /table
/form /center /div p /p p /p /body /html 2.注册程序 html head
titleregiste/title meta content=text/html; charset=gb2312 /head body
bgcolor=#FFFFFF div align=center p/p p/p p客商注册/p form method=post
action=zhuc.php p客商名: input type=text name=username /p p密码: input
type=password name=password /p p input type=submit name=Submit
value=显著 input type=reset name=Submit2 value=重来 /p /form p/p /div
/body /html 如要求ZIP文件可给自个儿写信。tandinet@163.net

//此页面为say.php ? include signup/mysql.inc; if($id1卡塔尔国{ $sql=select *
from $table where id=’$id1′;//显示回复标题 $result=mysql_query($sql)or
die(mysql_error()); $row=mysql_fetch_array($result);
$title=RE:.$row[title]; } $ip=$REMOTE_ADDR; $sql=select * from
user_stus where ip=’$ip’;//查询当前客商名 $result=mysql_query($sql)or
die(mysql_error()); $row=mysql_fetch_array($result);
if(!$row卡塔尔(قطر‎//判定客商是或不是登录 { echo htmldiv id=Layer2 z-index:1BRBRBRBLX570;
echo div id=Layer3 z-index:2img src=pic/3.gif width=15 height=15/div;
echodiv ;echo pfont size=2 color=#FF33CC嘻嘻!! 请首先登场录/font/p;
echopfont size=2 color=#FF33CCa
href=’.$PHP_SELF.?p=1&&table=$table’返回/a/font/p /div /html; exit(); }
else $userid=$row[userid]; if($okState of Qatar { if($title==||$content==卡塔尔国 { echo
B哈弗请你添完整后提交; } else{ $id=time(卡塔尔(قطر‎;//提交文章 $date1=date(Y/m/dState of Qatar;
$title=htmlspecialchars($title卡塔尔(قطر‎; $content=htmlspecialchars($contentState of Qatar;
$sql=select * from .$table; $result=mysql_query($sql)or
die(mysql_error()); $row1=mysql_num_rows($result); $row1++; if($id1){
$sql=insert into bbs_re
(id,userid,date1,title,content)values(‘$id’,’$userid’,’$date1′,’$title’,’$content’);
mysql_query($sql)or die(mysql_error()); $sql=select * from .$table.
where id=’$id1′; $result=mysql_query($sql)or die(mysql_error());
$lin=mysql_fetch_array($result); for($i=1;$i6;$i++) { $re=r.$i;
if(!$lin[$re]) break; } $sql=update .$table. set .$re.=’$id’ where
id=’$id1′; } else$sql=insert into .$table.
(id,userid,date1,title,content,row)values(‘$id’,’$userid’,’$date1′,’$title’,’$content’,’$row1′);
$result=mysql_query($sql)or die(mysql_error()); if($result) {
header(Location:php3.php?p=1&&table=$table); exit ; } } } ? html head
titlexiaoyang/title meta content=text/html; charset=gb2312 script
language=JavaScript1.2 src=js/menu_comment.js/script script
language=JavaScript1.2 src=js/fw_menu.js/script script
language=JavaScript !– function MM_reloadPage(init) {//reloads the
window if Nav4 resized if (init==true) with (navigator) {if
((appName==Netscape)&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW ||
innerHeight!=document.MM_pgH) location.reload(); }
MM_reloadPage(true); // — /script /head body bgcolor=#FFFFFF
text=#000000 div id=Layer1 style=position:absolute; left:31px; top:1px;
width:560px; height:46px; z-index:10 script
language=JavaScript1.2fwLoadMenus();/script/div div id=Layer6
style=position:absolute; left:409px; top:29px; width:118px; height:17px;
z-index:6/div div id=Layer5 style=position:absolute; left:86px;
top:63px; width:464px; height:303px; z-index:7form name=form1
method=post action=? echo $PHP_SELF ? table width=98% border=1
cellspacing=0 cellpadding=0 bordercolor=#FF99FF trtd width=26%
height=42div align=centerfont size=2 color=#FF33FF题目/font/div /td td
width=74% height=42input type=text name=title size=40 value=?echo $title
;? onMouseover=this.document.form1.title.focus();return true input
type=hidden name=table value=?echo $table ;? input type=hidden name=id1
value=? echo $id1 ;? br /td /tr trtd width=26% height=172div
align=centerfont size=2 color=#FF33FF内容/font/div /td td width=74%
height=172textarea name=content cols=40 rows=10 wrap=physical
value=?echo $content ;?
onMouseOver=this.document.form1.content.focus()/textarea /td /tr tr td
width=26% div align=center input type=reset name=Submit2 value=重写 /div
/td td width=74% div align=center input type=submit name=ok value=发表
/div /td /tr /table p/p /form /div div id=back style=position:absolute;
left:455px; top:30px; width:85px; height:3px; z-index:8hr color=#ff9999
noshade /div div id=goback style=position:absolute; left:461px;
top:23px; width:120px; height:16px; z-index:9div align=centera
href=php3.php?p=1&&table=?echo $table ;? target=_self
onMouseover=window.status=” ;return truefont size=2
color=#FF33FF返回/font/a/div /div p/p p/p /body /html

出于时间难点,代的付出部分行使的是人生观的表单POST,要是你钟爱能够凭借LOAD进程自行加上相应的SCTucsonIPT,可是好像只能用GET了。XML能够真正的根底代谢,假设手上有期望能借看看。

在这里感QQ群鲜绿雪狐和shelly水在JS上予的助,也新手能把团结的功效代出大家一块儿斟酌。

最後附上演示地址:_input.php
喜HACK外人器的爱侣手下留情,附上演示是了对象能更加快领会代。

input.php[HTML] 选取顾客输入数据。

PHP代码:———————————————-

?php /* 申 明 ——————————
该演示文件详细描述了应用JS+PHP对数据库举行似刷新读出写入的办法
2001年03月二十八日 By L.Fox */

header(“Cache-Control: no-store, no-cache,must-revalidate”卡塔尔国;
//行可以打消,把公文存成HTML echo $_POST[“name1”];
//我是了?#123;方便才加的。 ? html head meta “Content-Type”
content=”text/html; charset=??????”
title依据编号从MYSQL提取数据开展编写制定并回存[演示]/title script
language=”JavaScript” /script style body { font-family: “Verdana”,
“Arial”, “Helvetica”, “sans-serif”; font-size: 12px; line-height: 17px;
scrollbar-base-color: #BBBBBB; scrollbar-shadow-color: #BBBBBB;
scrollbar-highlight-color: #FFFFFF; scrollbar-3dlight-color: #000000;
scrollbar-darkshadow-color: #000000; scrollbar-arrow-color: #FFFFFF; }
table { border: 0; font-size: 12px; cursor: default; } td { text-align:
left; height: 20; } input { width: 100; height: 18; border: 0px solid
#666666; text-align: left; } /style script var objInput = null; var
objTd = null; var num =null; function AutoEdit(obj,id) { if (objInput ==
null) { objTd = obj; obj.innerHTML = “input size=”10″ maxlength=”10″
type=”text” value=”” + obj.innerText + “”
onblur=”objTd.innerText=this.value;LoadData(objTd.innerText,num);objInput=null;”
“; objInput = document.getElementById(“objInput”); objInput.focus(); } }

function LoadData(LoadIndex,LoadObj卡塔尔 { var
LoadFileName=”load.php?action=” + LoadIndex + “num=” + LoadObj;
document.getElementById(“LoadDataSrc”卡塔尔(قطر‎.src = LoadFileName; } function
OutPutData(objState of Qatar { if (form1.num1.value.length1卡塔尔国{ alert(“请输入数量1″State of Qatar;
return false;} if (form1.num2.value.length1State of Qatar{ alert(“请输入数量2″卡塔尔国;
return false;} if (document.getElementById(“name1″卡塔尔(قطر‎.innerHTML.length1卡塔尔{
alert(“name1空值”卡塔尔国; return false;} if
(document.getElementById(“name2″卡塔尔(قطر‎.innerHTML.length1State of Qatar{
alert(“name2空值”State of Qatar; return false;} obj.innerHTML=”input type=”hidden”
name=”name1″ value=”” + document.getElementById(“name1″卡塔尔(قطر‎.innerHTML +
“””; obj.innerHTML+=”input type=”hidden” name=”name2″ value=”” +
document.getElementById(“name2″卡塔尔(قطر‎.innerHTML + “””; obj.innerHTML+=”input
type=”hidden” name=”type1″ value=”” +
document.getElementById(“type1″State of Qatar.innerHTML + “””; obj.innerHTML+=”input
type=”hidden” name=”type2″ value=”” +
document.getElementById(“type2″State of Qatar.innerHTML + “””; obj.innerHTML+=”input
type=”hidden” name=”date1″ value=”” +
document.getElementById(“date1″卡塔尔国.innerHTML + “””; obj.innerHTML+=”input
type=”hidden” name=”date2″ value=”” +
document.getElementById(“date2″State of Qatar.innerHTML + “””;
obj.innerHTML+=form1.submit(State of Qatar; } function postdata(卡塔尔(قطر‎ { form1.submit(卡塔尔国; }
/script /head body form name=”form1″ method=”post”
action=”load.php?action=OutPutData” table width=”400″ cellpadding=”0″
cellspacing=”1″ align=”center” bgcolor=”#999999″ tr bgcolor=”#EFEFEF”
td onclick=”AutoEdit(this,num=1)” div/div/td td
onclick=”AutoEdit(this,num=2)” div/div/td /tr tr bgcolor=”#EFEFEF”
tddiv a/div/td tddiv b/div/td /tr tr bgcolor=”#EFEFEF” tddiv a/div/td
tddiv b/div/td /tr tr bgcolor=”#EFEFEF” tddiv /div/td tddiv /div/td /tr
tr bgcolor=”#EFEFEF” tddivinput type=”text” name=”num1″ value=””/div/td
tddivinput type=”text” name=”num2″ value=””/div/td /tr div a href=”#”

onclick=”java script:OutPutData(this);”输出/a/div/form /body /html

LOAD.php

PHP代码:———————————————–

?php header(“Cache-Control: no-store, no-cache,must-revalidate”);
include(“obj/financial_obj_free.inc”卡塔尔(قطر‎;
//这么些文件里的剧情是三番五回MYSQL的语句。 $str=$_GET[“action”];
$num=$_GET[“num”]; if ($str==”OutPutData”) OutPutData(); else {
linkdata(“financial”,1); $sql=”select * from table where id=$str”; if
($query=mysql_query($sql)) { $temdata=mysql_fetch_row($queryState of Qatar;
//看看是不是空的,如若是就附上值以防JS报错。 if
(strlen($temdata[2])1||$temdata[2]==””) $temdata[2]=”空”;
$temdata[2]=htmlspecialchars($temdata[2]); if
(strlen($temdata[3])1||$temdata[3]==””) $temdata[3]=”空”;
$temdata[3]=htmlspecialchars($temdata[3]); if
(strlen($temdata[5])1||$temdata[5]==””) $temdata[5]=”空”;
$temdata[5]=htmlspecialchars($temdata[5]); } else {
$temdata[2]=$temdata[3]=$temdata[5]=”查询退步”; } switch ($num卡塔尔国//那个主假诺用来检查是从第几列(行卡塔尔(قطر‎传过来的。注意变量值要与input的id值对应好.不然出错
{ case 1: $diva=”name1″; $divb=”type1″; $divc=”date1″; break; case 2:
$diva=”name2″; $divb=”type2″; $divc=”date2″; break; default:
$diva=”name1″; $divb=”type1″; $divc=”date1″; break; }
//分明节点,输出$temdata[X]到节点$divX; echo
“document.getElementById(“.$diva.”).innerHTML=”.$temdata[2].”;”; echo
“document.getElementById(“.$divb.”).innerHTML=”.$temdata[3].”;”; echo
“document.getElementById(“.$divc.”).innerHTML=”.$temdata[5].”;”; }

function OutPutData(State of Qatar //那上边如果改成SQL语句就足以写进数据库 { echo
“输出的数目如下,改成SQL语句然后就能够保存下来”; echo
“编号1=”.$_POST[“name1″].”br”; echo “编号2=”.$_POST[“name2″].”br”;
echo “名称1=”.$_POST[“type1″].”br”; echo
“名称2=”.$_POST[“type2″].”br”; echo “日期1=”.$_POST[“date1″].”br”;
echo “日期2=”.$_POST[“date2″].”br”; echo
“数量1=”.$_POST[“num1″].”br”; echo “数量2=”.$_POST[“num2″].”br”;
echo “a href=”text_input.php”返回/a”; } ?

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图