這裏是我的代碼如何調用在MySQL中值,則變成一個可變
<?php
require("db.php");
$datetoday = date("Y-m-d");
if (isset($_POST['submit']))
{
include 'db.php';
$loginid =$_REQUEST['loginid'];
$result = mysql_query("SELECT * FROM info WHERE id = '$loginid'");
$test = mysql_fetch_array($result);
$testid=$test['id'];
$fnameloginsuccess1=$test['firstname'];
$mnameloginsuccess1=$test['middlename'];
$lnameloginsuccess1=$test['lastname'];
$departmentloginsuccess1=$test['department'];
echo'<input type="text" name="fname" value="<?php echo $fnameloginsuccess1 ?>"/></td>';
if (!$loginid)
{header("location:../index.php"); }
$natureofleave =$_POST['group1'];
$datestart=$_POST['startofleave'];
$dateend=$_POST['endofleave'];
$reason=$_POST['reason'];
$status= 'pending';
mysql_query("INSERT INTO `request`(id,natureofleave,dateofleavestart,dateofleaveend,reasons,datesubmitted,department,status,firstname,middlename,lastname)
VALUES('$log','$natureofleave','$datestart','$dateend','$reason','$datetoday','$departmentloginsuccess1','$status','$fnameloginsuccess1','$mnameloginsuccess1','$$lnameloginsuccess1')");
}
我的主要問題是我不能忍受的fnameloginsuccess1 $,$ mnameloginsuccess1' 值,‘$ lnameloginsuccess1’, $ departmentloginsuccess1在我的數據庫.. 但我可以「回聲」他們..有些值正在工作,但4個值沒有工作! 我已經試過fname = $ fnameloginsuccess1';可悲地說,它沒有工作.. 幫助!
上
user3188604
我確實提供了有關調試的信息,因此請嘗試使用這些信息並將結果回傳。 – MrMarlow