zl程序教程

您现在的位置是:首页 >  后端

当前栏目

PHP分多步骤填写发布信息的简单方法实例代码

实例PHP方法代码 简单 发布 步骤 信息
2023-06-13 09:14:35 时间
1.php
复制代码代码如下:

<formname=form1id=form1method=postaction=2.php>
基本信息1:<inputtype=textname=base1/>
基本信息2:<inputtype=textname=base2/>
<inputtype=submitvalue="下一步">
</form>

2.php
复制代码代码如下:

<formname=form2id=form2method=postaction=3.php>
产品名称:<inputtype=textname=prcname/>
产品价格:<inputtype=textname=price/>
产品型号:<inputtype=textname=prcXH/>
<inputtype=hiddenname=base1value="<?phpecho$_REQUEST["base1"]?>"/>
<inputtype=hiddenname=base2value="<?phpecho$_REQUEST["base2"]?>"/>
<inputtype=submitvalue=下一步/>
</form>

3.php
复制代码代码如下:
<formname=form3id=form3method=postaction=4.php>
其他信息1:<inputtype=textname=other1/>
其他信息2:<inputtype=textname=other2/>
<inputtype=hiddenname=base1value=<?phpecho$_REQUEST["base1"]?>/>
<inputtype=hiddenname=base2value=<?phpecho$_REQUEST["base2"]?>/>
<inputtype=hiddenname=prcnamevalue=<?phpecho$_REQUEST["prcname"]?>/>
<inputtype=hiddenname=pricevalue=<?phpecho$_REQUEST["price"]?>/>
<inputtype=hiddenname=prcXHvalue=<?phpecho$_REQUEST["prcXH"]?>/>
<inputtype=submitvalue=确定/>
</form>

4.php
复制代码代码如下:
<?php
$base1=$_REQUEST["base1"];
$base2=$_REQUEST["base2"];
$prcname=$_REQUEST["prcname"];
$price=$_REQUEST["price"];
$prcXH=$_REQUEST["prcXH"];
$other1=$_REQUEST["other1"];
$other2=$_REQUEST["other2"];

$sql1="insertinto[base_table](base1,base2)values("{$base1}","{$base2}")";
$sql2="insertinto[prc_table](prcname,price,prcXH)values("{$prcname}","{$price}","{$prcXH}")";
$sql3="insertinto[other_table](other1,other2)values("{$other1}","{$other2}")";
query($sql1);
query($sql2);
query($sql3);

echo"写入完成";
?>