|
 |
|
$_SERVER['PHP_SELF'] หมายถึงอะไรคะทำไมlinkกลับไปที่หน้า index.php ตลอดเลยคะ |
|
 |
|
|
 |
 |
|
พอกด submit แล้วจะทำกๅร query หน้าตัวเองครับ
|
 |
 |
 |
 |
Date :
2011-06-29 23:06:24 |
By :
ManGal49 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วเราจะแก้ยังไงดีคะ
---------------------------------------------
ขอบคุนมากคะ ^_^
|
 |
 |
 |
 |
Date :
2011-06-29 23:27:40 |
By :
Poster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
if(!$btnsubmit){
?>
<form name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<label for="txt1">Label : </label>
<input type="text" name="txt1" id="txt1" />
<input type="submit" name="btnsubmit" id="btnsubmit" value="Submit" />
</form>
<?php
}else{
echo $_POST['txt1'];
}
?>
</body>
</html>
Example ให้ดูนะครับ ลองนำไปประยุกต์ดูครับ
|
 |
 |
 |
 |
Date :
2011-06-30 02:41:56 |
By :
ppanchai |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังทำไม่ได้เลยคะ
-------------------------------
ตรงนี้คือยังไงคะ ??
else{
echo $_POST['txt1'];
|
 |
 |
 |
 |
Date :
2011-06-30 09:33:23 |
By :
Poster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
displayBls.php
<?php
include 'data.class.php';
$options = array(
'pagerank' => true,
'AlexaRank' => true,
'backlinksAlexa' => true,
'dmoz' => true,
'yahooDirectory' => true,
'backlinksGoogle' => true,
'indexedGoogle' => true,
'backlinksYahoo' => true,
'indexedYahoo' => true,
'backlinksMSN' => true,
'indexedMSN' => true,
'age' => true,
);
if ($_POST['urlname']) {
$urlname = split("\n", $_POST['urlname']);
$results = array();
foreach ($urlname as $url) {
$data = new pagerank(trim($url));
$results[] = array(
'url' => $data->url['host'],
'pagerank' => $data->getPagerank(),
'AlexaRank' => $data->getAlexaRank(),
'backlinksAlexa' => $data->getBacklinksAlexa(),
'dmoz' => $data->getDmoz(),
'yahooDirectory' => $data->getYahooDirectory(),
'backlinksGoogle' => $data->getBacklinksGoogle(),
'indexedGoogle' => $data->getIndexedGoogle(),
'backlinksYahoo' => $data->getBacklinksYahoo(),
'indexedYahoo' => $data->getIndexedYahoo(),
'backlinksMSN' => $data->getBacklinksMSN(),
'indexedMSN' => $data->getIndexedMSN(),
'age' => $data->getAge()
);
}
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<div class="title"><p>Search Engine backlink and indexed page statistics</p></div>
<p>This is backlink and index checker tool to check your backlinks and indexed pages statistics from three major search engines: Google, Yahoo and Alexa.
</p>
<!-- สร้าง form สำหรับการกรอก Domain name เข้ามาก่อน ส่งค่าไปที่หน้า data.class.php ใช้ Method แบบ Post -->
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table width="433" border="0">
<tr>
<td width="171">Enter the Website Domain:</td>
<td width="246"><label>
<input type="text" name="urlname" id="urlname" width="246" class="box" >
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="checker" id="checker" value="Check ">
</label></td>
</tr>
</table>
</form>
<?php
if ($results) {
?>
<table width="433" border="1">
<tr class="head">
<td colspan="3">Website Domain: <? echo $url; ?> </td> <!-- แสดงชื่อ Domain Name -->
</tr>
<tr>
<td width="148">Search Engine</td>
<td width="129">Backlinks</td>
<td width="131">Indexed Pages</td>
</tr>
<?php
foreach ($results as $result) {
?>
<tr class="result">
<td>Google</td>
<td><?php echo $result['backlinksGoogle']; ?></td>
<td><?php echo $result['indexedGoogle']; ?></td>
</tr>
<tr>
<td>Yahoo!</td>
<td><?php echo $result['backlinksYahoo']; ?></td>
<td><?php echo $result['indexedYahoo']; ?></td>
</tr>
<tr>
<td>Alexa</td>
<td><?php echo $result['backlinksAlexa']; ?></td>
<td> </td>
</tr>
<tr>
<td colspan="3">Note: You may get a different result with or without "www"</td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</div>
</body>
</html>
|
ประวัติการแก้ไข 2011-06-30 09:39:25 2011-06-30 09:40:40
 |
 |
 |
 |
Date :
2011-06-30 09:36:12 |
By :
Poster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|