如何在提交表单时在mysql数据库中存储会话名字?

时间:2017-09-25 18:08:01

标签: php html5 pdo

如何在提交表单时将会话传递到数据库中。我试着让每个人都明白这一点。谢谢你的协助。我不太明白。

PHP-我也有会话启动。

<?php

 require('Conn.php');

$statement = $link->prepare("INSERT INTO Database(Client_FN, email) VALUES( :CFN, :Email)");

$ClientFN = $_POST['Client_FN'];  <-- I want to insert $_SESSION['first_name'] into the database. - Not sure how to do this?
$ClientEmail = $_POST['email'];

$statement->execute(array(
":CFN" => "$ClientFN");
":Email" => "$ClientEmail");

 // Echo Successful attempt
    echo "<p Data added to database.</p></br></br>";

    $statement = null;
    $link = null;

      ?>

HTML

<label> Name: <input name="Client_FN" type="text" 
class="form-control" id="" value="<?php echo $_SESSION['first_name']; ?>"> </label> </div> 

 <label> Name: <input name="email" type="text" 
class="form-control" id="" value=""> </label> </div> 

0 个答案:

没有答案