Home  >  Article  >  Backend Development  >  PHP把数据也传到下一个页面

PHP把数据也传到下一个页面

WBOY
WBOYOriginal
2016-06-23 13:34:131118browse

<?php /*数据存到数据库成功之后想跳转到下一个页面,PHP然后把数据也传到下一个页面php里面当页面读取结束的时候,所有的变量将全部清空,所以需要通过别的手段来传值,*///1、通过url参数 比如:在跳转链接上加上?id1=$id1&id2=$id2 //这个最常用,也最省资源,但传递的内容有限。///2、保存到session。将数据保存到特定的session中,到下个页面再从session中取出//3、保存到cookie。setcookie('emailaddress',$email_address,time()+3600,'/');//4、调用php的curl函数,将数据post到下个页面,$Data = array('emailaddress' => '123456');curl_setopt($ch, CURLOPT_POSTFIELDS, $Data);?><input name="mail" value="<?php echo $_COOKIE[" emailaddress>" /><input name="test" value="<?php echo $Data['emailaddress']?>"><?php //清除cookiesetcookie("phone_number", "", time()-3600);?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn