可能重複:
PHP: 「Notice: Undefined variable」 and 「Notice: Undefined index」未定義指數錯誤信息
我是新來的PHP,並玩了。我在我的PHP文件中有以下代碼。
$output = "<div style='display:none'>
<div class='contact-top'></div>
<div class='contact-content'>
<h1 class='contact-title' style='text-align:center'>Write a Testimonial:</h1>
<div class='contact-loading' style='display:none'></div>
<div class='contact-message' style='display:none'></div>
<form action='#' style='display:none'>
<label for='contact-name'>*Name:</label>
<input type='text' id='contact-name' class='contact-input' name='name' tabindex='1001' />
<label for='contact-email'>*Email:</label>
<input type='text' id='contact-email' class='contact-input' name='email' tabindex='1002' />";
if ($extra["form_subject"]) {
$output .= "
<label for='contact-subject'>Subject:</label>
<input type='text' id='contact-subject' class='contact-input' name='subject' value='' tabindex='1003' />";
}
$output .= "
<label for='contact-message'>*Message:</label>
<textarea id='contact-message' class='contact-input' name='message' cols='40' rows='4' tabindex='1004'></textarea>
<br/>";
if ($extra["form_cc"]) {
$output .= "
<label> </label>
<input type='checkbox' id='contact-cc' name='cc' value='1' tabindex='1005' /> <span class='contact-cc'>Send me a copy</span>
<br/>";
}
$output .= "
<label> </label>
<button type='submit' class='contact-send contact-button' tabindex='1006'>Send</button>
<button type='submit' class='contact-cancel contact-button simplemodal-close' tabindex='1007'>Cancel</button>
<br/>
<input type='hidden' name='token' value='" . smcf_token($to) . "'/>
</form>
</div>
</div>";
echo $output;
當我試圖運行的代碼,雖然模型框出現,但也呈現出一個PHP錯誤。
下面是錯誤消息我收到
注意:未定義指數:form_cc在F:\ WAMP \ WWW \博客\ WordPress的\可溼性粉劑內容\插件\演示\上線56 contact.php
任何想法是什麼問題?