1.在JavaScript中点击按钮跳转执行PHP程序
<input type="button" name="return" value="插入记录" onClick='javascript: window.location = "student_add.php"'>
2.显示一个带变量的窗口
<?php
$fail="添加失败,原因:".mysql_error();
?>
<input type="hidden" name="did" value="<?=$fail;?>">
<script language="javascript" type="text/javascript">
alert(did.value);
location.href ='student_show.php';
</script>
3.点击按键,跳转界面,并传值
firsh.php
</td>
<form action="second.php" target="_parent">
<td width="80" height="30"> <input type="submit" name="return" value="修改记录" >
</td>
<input type="hidden" name="id" value="<?php echo $info['S_Num']; ?>" />
</form>
second.php
<?
$id=$_GET[id]; //先接收从news.php传过来的ID值以确定要修改的新闻接着查出该新闻有关数据.
mysql_query("SET NAMES 'utf8'");
$query = "select * from student where S_Num=$id";
$res = mysql_query($query);
$row = mysql_num_rows($res); //如果查询成功这里返回真否则为假
$dbrow=mysql_fetch_array($res);
$S_Num=$dbrow[S_Num];
$S_Name=$dbrow[S_Name];
$S_Age=$dbrow[S_Age];
$S_Sex=$dbrow[S_Sex];
$S_Class=$dbrow[S_Class];
$S_Department=$dbrow[S_Department];
$S_Phone=$dbrow[S_Phone];
$S_Permitted=$dbrow[S_Permitted];
$S_Pwd=$dbrow[S_Pwd];
?>
4. php将数据库查询到的值显示在textarea里面
<textarea name="Introduction" cols="55" rows="5" "><? echo $Introduction; ?></textarea>