2011-05-11 27 views
0

所以我在传递给PHP脚本的HTML页面上填写了一个表格。 PHP运行良好,但我在PHP页面上显示HTML时遇到了一些麻烦。如果在HTML的主体我做<?php echo $message; ?>变量显示正常。但只要我尝试添加格式(特别是div和header),页面上就不显示任何内容。这是我得到的。PHP和jQTouch

<?php 
session_start(); 

//declare variables 
$name = $_POST['name']; 
$email = $_POST['email']; 
$phone = $_POST['phone']; 
$comments = $_POST['comments']; 
$date = $_POST['date']; 
$time = $_POST['time']; 
$company = 'Test company'; 

$_SESSION['name'] = $name; 
//strip of invalid chars 
$date = str_replace('/' , '.' , $date); 

//fopen 
$pathToMe = dirname(__FILE__); 
$fileName = $pathToMe . "/days/" . $date; 
$fileHandle = fopen($fileName, 'w') or die("Failure."); 
fwrite($fileHandle, $name . "\n" . $email . "\n" . $phone . "\n" . $date . "\n" . $time . "\n" . $comments . "\n" . "\n"); 
fclose($fileHandle); 

//email to company 
$to = '[email protected]'; 
$subject = 'Apointment scheduled online'; 
$body = "An apointment was just scheduled online.\n" . $name . "\n" . $email . "\n" . $phone . "\n" . $date . "\n" . $time . "\n" . $comments . "\n" . "\n" . "Please follow up to confirm."; 
if (mail($to, $subject, $body)) { 
    $companyConfirm = 'yes'; 
} else { 
    $companyConfirm = 'no'; 
} 

//client confirm 
$to = $email; 
$subject = 'Confirming your appointment'; 
$body = "Hello " . $name . "," . "\n" . "\n" . "You recently booked an appointment with " . $company . " on " . $date . " at " . $time . ".\n" . "\n" . "We will follow up soon to confirm."; 
if (mail ($to, $subject, $body)) { 
    $confirm = 'yes'; 
} else { 
    $confirm = 'no'; 
} 

//confirm email 
if ($companyConfirm = $confirm) { 
    if ($companyConfirm = 'yes') { 
     $message = "Your appointment has been confirmed. You will recieve a confirmation email shortly"; 
     print "<div id=\"jqt\"><div id=\"home\" class=\"current\"><h1>Scheduler</h1><ul class=\"edit rounded\"><li>" . $message; 
    } 
    else {} 
} else { 
    $message = "There was a problem making your appointment. Please call to schedule."; 
} 

$_SESSION['message'] = $message; 
?> 

<html> 
<body> 
<div id="home"> 
<div class="toolbar"> 
<h1>Scheduler</h1> 
<a class="back" href="#home">Back</a> 
</div> 
<ul class="edit rounded"> 
<li><?php echo $message; ?></li> 
</ul> 
</div> 
</div> 
</body> 
</html> 

任何思考如何让$message显示内嵌格式将不胜感激。

+1

看不出什么了手,将使其失败,但有一点我注意到的是,你有'$ companyConfirm = $ confirm',这可能不是你想要的(赋值与平等)。 – 2011-05-11 01:02:38

+0

感谢您指出,修复。 – 2011-05-11 01:06:05

回答

2

您是否在其他浏览器中尝试过?

看来你有一个额外的</div>以前</body>

如果是这样的情况下,即使它没有你的浏览器窗口中显示出来,你应该看到,如果你看一下HTML源代码。

编辑:你也有print声明,留下一个li和很多div标签打开

您正在使用什么版本JQT的