0
我在這裏要做的是發送一封電子郵件給銷售人員,通知他們他們的客戶已經查看過Google文檔演示文稿。
查詢的Num = val是我用來從數據庫中獲取實際的Google文檔的URL並將其填充到表單中的序列號。重定向發生在表單數據處理之前
我的問題是,頁面重定向檢索到的數據之前,並最終將默認爲站點,nitrofill.com.index
的gdform.php文件頭重定向,工作正常如果我不嘗試在頁面加載時處理表單。繼承人的代碼:
<?php
$sn=$_GET['num'];
echo $sn;
mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname);
$selectSQL = "select * from `Presentations` where `serialnum` ='" . $sn ."'" ;
$result = mysql_query($selectSQL) or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_BOTH);
?>
<script type="text/javascript">
function myfunc() {
var frm = document.getElementById("notice");
frm.submit();
}
window.onload = myfunc;
</script>
<title>Nitrofill Document</title></head>
<body>
<form id="notice" action="http://m3sglobal.com/gdform.php" method="post">
<input type="hidden" name="subject" value="<?php echo (urldecode($row['recipient'])) . " has viewed the document you sent them."; ?>" />
<input type="hidden" name="redirect" value="<?php echo ((urldecode($row['docurl']))); ?>"/>
<label>Email:</label><input type="text" name="email" value="<?php echo (urldecode($row['tracker'])); ?>"/>
<label>Comments:</label><textarea name="comments" cols="40" rows="5">
Document Viewed:<?php echo ((urldecode($row['docurl']))); ?>
When Accessed:<?php echo ((urldecode($row['last_accessed']))); ?>
</textarea>
<input type="submit" name="submit"/>
</form>
的gdform.php不重定向這樣的:
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: " . $landing_page);
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}
爲尋找謝謝!
是的,那並沒有這樣做。出於某種原因,gdform.php不再從第一頁獲取查詢字符串。我打破了一些東西,但還沒有弄清楚。它看起來像$ query_vars被重置,無論如何,這總是會使這個默認返回到HTTP_HOST。我試着評論這一點,它一直工作。然後它再次開始回到HTTP_HOST,即使該行被註釋掉了。 – 2012-02-24 01:29:45
$ request_method = $ _SERVER [「REQUEST_METHOD」]; if($ request_method ==「GET」){ $ query_vars = $ _GET; ($ request_method ==「POST」){ $ query_vars = $ _POST; } reset($ query_vars); $ t = date(「U」); – 2012-02-24 01:30:07
我認爲問題出在服務器端。你的表單看起來不錯。 – 2012-02-24 01:52:31