问题2:当这个页面第一次打开的时候 全贴出来看看还有, if():else:endif;这种写法俺没见过……-_-!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在表单里加一个hidden, 名是action,值是doinsert,然后在PHP里if($_POST["action"]=="doinsert"){//再做插入的事吧.很基本的} to: haosee(StartMenu) ,全贴出来怕人没耐心看呢我的写法是照着php手册上写的啊!我手上一本php书都没有,完全属于盲人摸象写代码,所有的思路和写法都是从网上抄的,也是我第一次写BS的,所以问题多多,让你见笑了:)顺便告诉你怎么写吧,免得以后让更多的人笑话~~~<body><form name="form1" method="post" action="http://localhost/voice/add.php"> <table width="475" border="0" bgcolor="#B4DADA"> <tr> <td height="35"><div align="left">文件名 <input width="100" type="text" name="Avfilename"> </div></td> <td><div align="left">中文名 <input width="100" type="text" name="Avname"> </div></td> </tr> <tr> <td height="43"><div align="left">内 容 <textarea width="100" name="Atext"></textarea> </div></td> <td><div align="left">所属栏目 <select name="Aselect"> <option></option><? $connt=mssql_connect("nenuzhou","sa",""); mssql_select_db("VServiceManager",$connt) or die ("不能连接到数据库!"); $strQuery="SELECT P_Name,P_Id FROM Program where P_IsChildFlag=1"; $rs=@mssql_query($strQuery); while($array=mssql_fetch_row($rs)) { echo "<option value=\"$array[1]\">".$array[0]."</option>"; }?> </select> </div></td> </tr> <tr> <td height="30"> </td> <td><input type="submit" name="Submit" value="提交"> </td> </tr> </table></form><? $connt=mssql_connect("nenuzhou","sa",""); mssql_select_db("VServiceManager",$connt) or die ("不能连接到数据库!"); $filename=$_POST["Avfilename"]; $name=$_POST["Avname"]; $text=$_POST["Atext"]; $select=$_POST["Aselect"]; if (!$filename||!$name): echo "添加失败!请检查文件名和中文名不能为空!"; else :$strAdd="insert into VoiceFile(V_FileName,V_Name,V_Text,P_id) values('$filename','$name','$text','$select')"; endif; $result=mssql_query($strAdd); ?><p><a href="add.php">继续添加</a> <a href="3F.htm">返回</a></p></body></html> ...<?if($_POST["Submit"]){ $connt=mssql_connect("nenuzhou","sa",""); mssql_select_db("VServiceManager",$connt) or die ("不能连接到数据库!"); $filename=$_POST["Avfilename"]; $name=$_POST["Avname"]; $text=$_POST["Atext"]; $select=$_POST["Aselect"]; if (!$filename||!$name): echo "添加失败!请检查文件名和中文名不能为空!"; else :$strAdd="insert into VoiceFile(V_FileName,V_Name,V_Text,P_id) values('$filename','$name','$text','$select')"; endif; $result=mssql_query($strAdd);}?> 谢谢zhutimy() ! 结账 我第一次做,再次感谢zhutimy() 的理解和帮助你回第二个帖子前我照你开始写的改好了,问题解决 求一个大文件上传源码 用PHP做,太平洋这样的网站需要多少钱??? redhatlinux9.0下http服务无法启动问题 fopen函数求解 在 Fc5 中安装 mysqli 扩展遇到郁闷问题! 请大家帮忙! 兄弟们,帮我看下这串码怎么数据插入不了? 域名设置 晕~~!开坛后回的帖都没了!还请ccterran大侠再指点一番 比较有用的东东,待解决中。高手请进。。。 多层if可以用正则处理吗 初学者,问各位高手一个问题 sv() 是干嘛的???????????? 请问php+access能实现吗?
//再做插入的事吧.很基本的
}
我的写法是照着php手册上写的啊!我手上一本php书都没有,完全属于盲人摸象写代码,所有的思路和写法都是从网上抄的,也是我第一次写BS的,所以问题多多,让你见笑了:)顺便告诉你怎么写吧,免得以后让更多的人笑话~~~
<body>
<form name="form1" method="post" action="http://localhost/voice/add.php">
<table width="475" border="0" bgcolor="#B4DADA">
<tr>
<td height="35"><div align="left">文件名
<input width="100" type="text" name="Avfilename">
</div></td>
<td><div align="left">中文名
<input width="100" type="text" name="Avname">
</div></td>
</tr>
<tr>
<td height="43"><div align="left">内 容
<textarea width="100" name="Atext"></textarea>
</div></td>
<td><div align="left">所属栏目
<select name="Aselect">
<option></option>
<?
$connt=mssql_connect("nenuzhou","sa","");
mssql_select_db("VServiceManager",$connt) or die ("不能连接到数据库!");
$strQuery="SELECT P_Name,P_Id FROM Program where P_IsChildFlag=1";
$rs=@mssql_query($strQuery);
while($array=mssql_fetch_row($rs))
{
echo "<option value=\"$array[1]\">".$array[0]."</option>";
}
?>
</select>
</div></td>
</tr>
<tr>
<td height="30"> </td>
<td><input type="submit" name="Submit" value="提交"> </td>
</tr>
</table>
</form>
<?
$connt=mssql_connect("nenuzhou","sa","");
mssql_select_db("VServiceManager",$connt) or die ("不能连接到数据库!");
$filename=$_POST["Avfilename"];
$name=$_POST["Avname"];
$text=$_POST["Atext"];
$select=$_POST["Aselect"];
if (!$filename||!$name): echo "添加失败!请检查文件名和中文名不能为空!";
else :$strAdd="insert into VoiceFile(V_FileName,V_Name,V_Text,P_id) values('$filename','$name','$text','$select')";
endif;
$result=mssql_query($strAdd);
?>
<p><a href="add.php">继续添加</a> <a href="3F.htm">返回</a></p>
</body>
</html>
<?
if($_POST["Submit"]){
$connt=mssql_connect("nenuzhou","sa","");
mssql_select_db("VServiceManager",$connt) or die ("不能连接到数据库!");
$filename=$_POST["Avfilename"];
$name=$_POST["Avname"];
$text=$_POST["Atext"];
$select=$_POST["Aselect"];
if (!$filename||!$name): echo "添加失败!请检查文件名和中文名不能为空!";
else :$strAdd="insert into VoiceFile(V_FileName,V_Name,V_Text,P_id) values('$filename','$name','$text','$select')";
endif;
$result=mssql_query($strAdd);
}
?>
结账
你回第二个帖子前我照你开始写的改好了,问题解决