내가 페이지방법 헤더에 변수를 구문 분석() 페이지
`
<form method="post" action="" >
<div id="search">
<form method="post" action="" >
<input type="text" name="keywords" placeholder = "Try your luck"/><input type="submit" value="Search" />
</form>
<?php
if(isset($_POST['keywords'])){
$keywords = mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));
$errors = array();
if(empty($keywords)){
$errors[] = 'Please enter a search term';
}
else if(strlen($keywords)<3){
$errors[] = 'Your search term must be three or more characters';
}
else if(search_results($keywords) === false){
$errors[] = 'Your search for '.$keywords.' returned no results';
}
if(empty($errors)){
header ('Location: search-page.php');
}
else{
foreach($errors as $error){
echo $error;
}
}
}
?>
문제에이 코드를 가지고하는 것은 내가 searchpage.php 페이지에서 변수 $ 키워드를 뭐지 할 것입니다 . 어떻게 그것을 성취 할 수 있습니까?
편집 : 검색 page.php의 코드는 다음과 같습니다
<?php include_once('headersearch.php');
include ('includes/func.inc.php');
global $variable;
?>
<table id="content-area">
<tr>
<td id="search-page" valign="top">
<?php
$results = search_results($keywords);
$results_num = count($results);
if($results_num == 1){
$s = "result";
}
else{
$s = "results";
}
echo '<p>Your Search for <strong>',$keywords,'</strong> returned <strong>',$results_num,'</strong> ',$s,'</p>';
foreach($results as $results){
?>
<table id="posts">
<tr height="25px"><td><h1><?php echo $results['article_title'] ; ?></h1></td></tr>
<tr><td><h2><span>Posted on</span> :<?php echo date('l jS',$results['article_timestamp']) ?> <span>By</span>: BMC </h2></td></tr>
<tr><td><h3><?php echo substr($results['article_content'], 0, 300) ; ?>[...]</h3></td></tr>
<tr><td><a href="single.php?id=<?php echo $results['article_id']; ?>" title="TEST" class="button">Read Along</a></td></tr>
</table>
<?php
}
?>
<?php include_once('sidebar.php'); ?>
</form>
</td>
</tr>
<?php include_once('footer.php'); ?>
최대한 빨리 psible
로 제발 도와주세요
searchpage.php 페이지에서 $ keywords 변수를 사용한다는 것은 무엇을 의미합니까? searchpage.php 페이지에 대한 코드를 게시 할 수 있습니까? – Maximus2012
다른 '
또한 헤더 함수 호출 후에 exit를 추가해야합니다. – Maximus2012