|
|
|
ช่วยดูหน่อยคะ มันไม่บันทึกลง DB (add/insert DB) Plz!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
|
|
|
|
|
|
datawebform.php
<?
include("./config/config.php");
if($_POST["add_submit"]){
if(copy($_FILES["filUpload"]["tmp_name"],"./logo images/".$_FILES["filUpload"]["name"]))
{
//*** Insert Record ***//
$strSQL = "INSERT INTO webdata (domainname,title,descrip,tags,languages,address,contact,logo_pic) VALUES ('".$_POST[ "txtdomainname"]."','".$_POST["txttitle"]."','".$_POST["txtdescrip"]."', '".$_POST["txttags"]."','".$_POST["txtlanguages"]."','".$_POST["txtaddress"]."', '".$_POST["txtcontact"]."','".$_FILES["filUpload"]["name"]."')";
$objQuery = mysql_query($strSQL);
}
}
?>
<html>
<head>
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body>
<div id="stylized" class="adddataform">
<form id="form" name="add" method="post" action="datawebform.php" enctype="multipart/form-data">
<h1>Add Website Data</h1>
<p>We know the web</p>
<label>Domain name<span class="small">Add Domain name</span></label>
<input name="txtdomainname" id="txtdomainname" />
<label>Title<span class="small">Add Title</span></label>
<input name="txttitle" id="txttitle" />
<label>Description<span class="small">Add Description</span></label>
<input name="txtdescrip" id="txtdescrip" />
<label>Key<span class="small">Add Key</span></label>
<input name="txttags" id="txttags" />
<label>Languages<span class="small">Add Languages</span></label>
<input name="txtlanguages" id="txtlanguages" />
<label>Address<span class="small">Add Address</span></label>
<input name="txtaddress" id="txtaddress" />
<label>Contact<span class="small">Add Contact</span></label>
<input name="txtcontact" id="txtcontact" />
<label>Logo<span class="small">Add Logo</span></label>
<input name="filUpload" type="file">
<button type="submit" name="add_submit">Save</button>
<div class="spacer"></div>
</form>
</div>
</body>
</html>
styles.css
/* CSS Document */
body
{
padding:0;
margin-top:150px;
font-family:Tahoma;
font-size:12px;
color:#999999;
background: #f3efe6 url(images/bg.jpg) center no-repeat;
height:260px;
line-height:18px;
}
a{ font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#ffffff; text-decoration:none;}
a:hover{font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#40920a; text-decoration:none;}
h1 { font: normal 11px Arial, Helvetica, sans-serif; color:#386e44; padding:0;}
.text{ font: normal 11px Arial, Helvetica, sans-serif; padding-left:20px; padding-right:20px; text-align:left;}
.textsignup { font: normal 11px Arial, Helvetica, sans-serif; padding-right:5px;}
.size { width:830px; margin:0 auto 0 auto;}
.bgmenu { background:url(images/bgmenu_02.png) left repeat-x; height:36px;}
.bgboxsearch { background:url(images/box-search_02.png) left repeat-y; width:615px;}
.bgboxright { background:url(images/box-right_02.png) left repeat-y; width:121px;}
.boxright { padding-top:25px;}
.sizefooter { width:100%; background:#ddd7c7;}
.bglinefooter { background:url(images/line-footer.png) top repeat-x; height:48px;}
.title { font: bold 20px Arial, Helvetica, sans-serif; color:#386e44; padding-left:20px; padding-right:20px;}
.inp { margin-left:20px; margin-top:10px; margin-bottom:10px; width:300px; height:30px; padding-top:10px; padding-left:20px; float:left;}
.mtsearch { vertical-align:top;}
.imgsearch { background:url(images/button-search.png) top no-repeat; width:84px; height:46px; border:none; padding-left:5px; padding-top:0px; margin-top:10px;}
.mleft { padding-left:5px; padding-top:50px;}
.textfoot { font: normal 11px Arial, Helvetica, sans-serif;}
p, h1, form, button{border:0; margin:0; padding:0;}
.spacer{clear:both; height:1px;}
.graph {
position: relative; /* IE is dumb */
width: 200px;
border: 1px solid #B1D632;
padding: 2px;
}
.graph .bar {
display: block;
position: relative;
background: #B1D632;
text-align: center;
color: #333;
height: 2em;
line-height: 2em;
}
.graph .bar span { position: absolute; left: 1em; }
/* ----------- My Form ----------- */
.adddataform{
margin:0 auto;
width:400px;
padding:14px;
}
/* ----------- stylized ----------- */
#stylized{
border:solid 2px #f3efe6;
background:#f8f6f2;
}
#stylized h1 {
font-size:14px;
font-weight:bold;
margin-bottom:8px;
}
#stylized p{
font-size:11px;
color:#666666;
margin-bottom:20px;
border-bottom:solid 1px #f3efe6;
padding-bottom:10px;
}
#stylized label{
display:block;
font-weight:bold;
text-align:right;
width:140px;
float:left;
}
#stylized .small{
color:#666666;
display:block;
font-size:11px;
font-weight:normal;
text-align:right;
width:140px;
}
#stylized .big{
color:#666666;
display:block;
font-size:14px;
font-weight:normal;
text-align:right;
width:140px;
}
#stylized input{
float:left;
font-size:12px;
padding:4px 2px;
border:solid 1px #f3efe6;
width:200px;
margin:2px 0 20px 10px;
}
#stylized button{
clear:both;
margin-left:150px;
width:125px;
height:31px;
background:#666666 url(img/button.png) no-repeat;
text-align:center;
line-height:31px;
color:#FFFFFF;
font-size:11px;
font-weight:bold;
}
Code
--
-- Database: `aboutus`
--
-- --------------------------------------------------------
--
-- Table structure for table `webdata`
--
CREATE TABLE `webdata` (
`domainname` varchar(100) COLLATE utf8_bin NOT NULL,
`title` varchar(1000) COLLATE utf8_bin NOT NULL,
`descrip` varchar(2000) COLLATE utf8_bin NOT NULL,
`tags` varchar(2000) COLLATE utf8_bin NOT NULL,
`languages` varchar(50) COLLATE utf8_bin NOT NULL,
`address` varchar(1000) COLLATE utf8_bin NOT NULL,
`contact` varchar(1000) COLLATE utf8_bin NOT NULL,
`logo_pic` varchar(2000) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`domainname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--
Tag : PHP
|
|
|
|
|
|
Date :
2011-07-12 22:31:55 |
By :
Poster |
View :
939 |
Reply :
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ก็ฟิลด์มี 8 แต่ values ที่ใส่มีแค่ 5 นี่ครับ ลองใส่ให้ครบดูนะครับ
|
|
|
|
|
Date :
2011-07-13 00:48:23 |
By :
ppanchai |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ครบแล้วนะคะ ช่วยดูอีกรอบนะคะ ขอบคุนมากคะ
|
|
|
|
|
Date :
2011-07-13 09:48:14 |
By :
Poster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo strSQL ดูครับ
|
|
|
|
|
Date :
2011-07-13 10:00:42 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo strSQL แล้วไม่มีไรออกคะ ทำไงต่อดีคะ
|
|
|
|
|
Date :
2011-07-13 10:10:44 |
By :
Poster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แสดงว่าไม่เข้าลูป strSQL ครับ ตอนแรกไม่ได้ดูโค๊ด
คุณ action ไปที่ไฟล์ datawebform.php ไม่ใช่หรอครับ แล้วมันจะเข้าเงื่อนไขได้อย่างไร แล้วมีการใช้คำสั่งดัก
if($_POST["add_submit"]){
อีก
ถ้าจะให้อยู่ในหน้าเดียวกัน แนะนำให้ใช้ $SEVER['PHP_SELF'] นะครับ
|
ประวัติการแก้ไข 2011-07-13 10:54:04
|
|
|
|
Date :
2011-07-13 10:52:07 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองเปลี่ยนเป็นแบบนี้ดูนะครับ
Code (PHP)
<?
include("./config/config.php");
if($_GET['Action']=insert){
if(copy($_FILES["filUpload"]["tmp_name"],"./logo images/".$_FILES["filUpload"]["name"]))
{
//*** Insert Record ***//
$strSQL = "INSERT INTO webdata (domainname,title,descrip,tags,languages,address,contact,logo_pic) VALUES ('".$_POST[ "txtdomainname"]."','".$_POST["txttitle"]."','".$_POST["txtdescrip"]."', '".$_POST["txttags"]."','".$_POST["txtlanguages"]."','".$_POST["txtaddress"]."', '".$_POST["txtcontact"]."','".$_FILES["filUpload"]["name"]."')";
$objQuery = mysql_query($strSQL);
}
}
?>
<html>
<head>
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body>
<div id="stylized" class="adddataform">
<form id="form" name="add" method="post" action="?Action=insert" enctype="multipart/form-data">
<h1>Add Website Data</h1>
<p>We know the web</p>
<label>Domain name<span class="small">Add Domain name</span></label>
<input name="txtdomainname" id="txtdomainname" />
<label>Title<span class="small">Add Title</span></label>
<input name="txttitle" id="txttitle" />
<label>Description<span class="small">Add Description</span></label>
<input name="txtdescrip" id="txtdescrip" />
<label>Key<span class="small">Add Key</span></label>
<input name="txttags" id="txttags" />
<label>Languages<span class="small">Add Languages</span></label>
<input name="txtlanguages" id="txtlanguages" />
<label>Address<span class="small">Add Address</span></label>
<input name="txtaddress" id="txtaddress" />
<label>Contact<span class="small">Add Contact</span></label>
<input name="txtcontact" id="txtcontact" />
<label>Logo<span class="small">Add Logo</span></label>
<input name="filUpload" type="file">
<button type="submit" name="add_submit">Save</button>
<div class="spacer"></div>
</form>
</div>
</body>
</html>
|
|
|
|
|
Date :
2011-07-13 10:56:26 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุนมากเลยคะ นั่งหงุนหงิดมากมายเลยคะ
ลองดูแล้วนะคะแต่มันขึ้นว่า
Not Found
The requested URL /Aboutus_p/$SEVER['PHP_SELF'] was not found on this server.
|
|
|
|
|
Date :
2011-07-13 11:08:37 |
By :
Poster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ขึ้น Not Found
The requested URL /Aboutus_p/$SEVER['PHP_SELF'] was not found on this server.แล้วคะ
แต่ก้อไม่ลงฐานยุดีคะ
|
|
|
|
|
Date :
2011-07-13 11:13:50 |
By :
Poster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?
include("./config/config.php");
?>
<html>
<head>
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body>
<div id="stylized" class="adddataform">
<?
if(!$add_submit){
?>
<form id="form" name="add" method="post" action="<?php $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
<h1>Add Website Data</h1>
<p>We know the web</p>
<label>Domain name<span class="small">Add Domain name</span></label>
<input name="txtdomainname" id="txtdomainname" />
<label>Title<span class="small">Add Title</span></label>
<input name="txttitle" id="txttitle" />
<label>Description<span class="small">Add Description</span></label>
<input name="txtdescrip" id="txtdescrip" />
<label>Key<span class="small">Add Key</span></label>
<input name="txttags" id="txttags" />
<label>Languages<span class="small">Add Languages</span></label>
<input name="txtlanguages" id="txtlanguages" />
<label>Address<span class="small">Add Address</span></label>
<input name="txtaddress" id="txtaddress" />
<label>Contact<span class="small">Add Contact</span></label>
<input name="txtcontact" id="txtcontact" />
<label>Logo<span class="small">Add Logo</span></label>
<input name="filUpload" type="file">
<button type="submit" name="add_submit">Save</button>
<div class="spacer"></div>
</form>
<?
}else{
if(copy($_FILES["filUpload"]["tmp_name"],"./logo images/".$_FILES["filUpload"]["name"]))
{
//*** Insert Record ***//
$strSQL = "INSERT INTO webdata (domainname,title,descrip,tags,languages,address,contact,logo_pic) VALUES ('".$_POST[ "txtdomainname"]."','".$_POST["txttitle"]."','".$_POST["txtdescrip"]."', '".$_POST["txttags"]."','".$_POST["txtlanguages"]."','".$_POST["txtaddress"]."', '".$_POST["txtcontact"]."','".$_FILES["filUpload"]["name"]."')";
$objQuery = mysql_query($strSQL);
}
}
?>
</div>
</body>
</html>
แบบนี้ครับ PHP SELF
|
ประวัติการแก้ไข 2011-07-13 14:27:12
|
|
|
|
Date :
2011-07-13 14:26:47 |
By :
ppanchai |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้ละคะ ขอบคุนมากเลยนะคะ หงุดหงิดมาตั้งนาน
|
|
|
|
|
Date :
2011-07-13 14:35:49 |
By :
Poster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|