开发者

registration form in multiple pages store in mysql

开发者 https://www.devze.com 2023-02-20 14:56 出处:网络
am new in php i have aregistration in three pages.if i click a last page submit the all va开发者_如何学JAVAlues should stored in db.how to do thisIn order to store all the values in the database you w

am new in php i have a registration in three pages.if i click a last page submit the all va开发者_如何学JAVAlues should stored in db.how to do this


In order to store all the values in the database you will need to pass them along the pages, maybe as hidden post fields. For example if your first page has something like

<input type="text" name="name" />

Your second and third pages should have something like

<input type="hidden" name="name" value="<?php echo $_POST['name'];?>"/ >

assuming that your form types are set to post.

To insert into the database when the last submit button is pressed you will need the mysql_query or PDO::exec function.

You may also want to look at Pdo::prepare, PDOStatement::execute and mysql_real_escape_string to protect your site against SQL Injection attacks


You can either pass the variables along as hidden form fields (see @Belinda's answer) or store them in a session.

0

精彩评论

暂无评论...
验证码 换一张
取 消