P H P  V I E T  N A M  P O R T A L
Xin chào, Khách. Vui lòng đăng nhập hoặc đăng ký tài khoản.
Bạn đã quên email kích hoạt?






     Trang chủ | Download | Tự học PHP | Kho tư liệu | Diễn đàn
Trang: 1 [2]
  In  
Current Topic Rating: ***
You have not rated this topic. Select a rating:
Tác giảChủ đề: Sửa Lỗi Khi Lập Trình PHP - Cơ bản  (Đã đọc 22653 lần)
lazy_cat@
PHP Starter
*
Posts: 2


Xem hồ sơ
« Trả lời #15 on: June 03, 2010, 11:09:00 PM »

Nó là một ký tự ẩn, trên trình duyệt thì bạn không thấy, nhưng khi view mã nguồn (HTML) của trang Web thì sẽ thấy.


thank you!
Logged
phuc237
PHP Starter
*
Posts: 3


Xem hồ sơ Email
« Trả lời #16 on: August 09, 2010, 11:49:26 PM »

<html>
<head>
</head>
<body>
<form action=as.php" method="POST">
<p><b>ten:</b><input type=text name=ten size=20></p>
<p><b>tuoi:</b><input type=text name=tuoi size=10></p>
<input type=submit name=submit value=submit>
</form>
<?php
$tuoi=$_POST["tuoi"];
$ten=$_POST["ten"];
echo " xin chao $ten. tuoi cua ban la $tuoi";
?>
</body>
</html>
moi nguoi bao phai bat register_globals len moi chay duoc code php minh khong bat duoc. Ban nao chi minh voi. Coi gium minh code so sai hok.Minh moi hoc php ah. thank nhieu
Logged
Neexare
PHP Starter
*
Posts: 24


Xem hồ sơ
« Trả lời #17 on: August 10, 2010, 02:06:03 PM »

Không phải đâu, ngược lại mình nghỉ là phải tắt register_globals đi thì đúng hơn. Ban thử đổi lại code thành:

echo "xin chao " . $_POST['ten'] . ". Tuoi cua ban la " . $_POST['tuoi'];
Logged
phuc237
PHP Starter
*
Posts: 3


Xem hồ sơ Email
« Trả lời #18 on: August 13, 2010, 09:02:58 PM »

con cach nao khac khong ban.  Minh muon thu nhieu cach hon!
Logged
phuc237
PHP Starter
*
Posts: 3


Xem hồ sơ Email
« Trả lời #19 on: August 14, 2010, 08:19:13 PM »

Minh thu cach do roi` khong duoc ban oi! Chi minh cach khac nha Sad
Logged
thienha20
PHP Intermediate
*
Posts: 102


Xem hồ sơ
« Trả lời #20 on: November 11, 2010, 09:58:56 PM »

<html>
<head>
</head>
<body>
<form action="" method="POST">
<p><b>ten:</b><input type='text' name='ten' size='20'/></p>
<p><b>tuoi:</b><input type='text' name='tuoi' size='10'/></p>
<input type='submit' name='submit' value='submit'>
</form>
<?php
if(isset($_POST['submit'])&&$_POST['submit']=='submit')
{
$tuoi=$_POST["tuoi"];
$ten=$_POST["ten"];
echo " xin chao $ten. tuoi cua ban la $tuoi";
}
?>
</body>
</html>
Logged
north3002
PHP Starter
*
Posts: 1


Xem hồ sơ Email
« Trả lời #21 on: March 21, 2011, 06:35:20 AM »

Mình đang tự học PHP. Nhưng mới vào là mắc lỗi mong các bạn giúp đỡ. Đùng chủi mình Ngu Nha.
mình làm 1 trang tinh diện tích hình cưữ nhật như sau mà nó không chạy.
báo lỗi ngay code "<?php echo $_POST["chieudai"]; ?>", <?php echo $_POST["chieudai"]; ?> (chieudai, chieurong undeifined)
<!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>dien tich hinh chu nhat</title>
</head>

<body>
<?php
$chieudai=$_POST["chieudai"];
$chieurong=$_POST["chieurong"];
$dt= $chieudai* $chieurong;
?>
<form id="form1" name="form1" method="post" action="DientichHCN.php">
  <table width="400" border="1" align="center">
    <tr>
      <td colspan="2">DIEN TICH HINH CHU NHAT</td>
    </tr>
    <tr>
      <td width="73">Chieu dai</td>
      <td width="111"><label for="chieudai"></label>
      <input name="chieudai" type="text" id="chieudai" value="<?php echo $_POST["chieudai"]; ?>" /></td>
    </tr>
    <tr>
      <td>Chieu rong</td>
      <td><label for="chieurong"></label>
      <input name="chieurong" type="text" id="chieurong" value="<?php echo $_POST["chieurong"]; ?>" /></td>
    </tr>
    <tr>
      <td>Dien tich</td>
      <td><label for="dt"></label>
      <input name="dt" type="text" id="dt" value="<?php echo "$dt";?> " /></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
        <input type="submit" name="Submit" id="button" value="Tinh" />
      </div></td>
    </tr>
  </table>
</form>

</body>
</html>

Các bạn giúp mình sớm nha. Cam ơn
Logged
saothienta
PHP Intermediate
*
Posts: 1016

darkmovies.4vn.in


Xem hồ sơ WWW Email
« Trả lời #22 on: March 26, 2011, 04:46:52 AM »

@north3002: trước tiên mình cần hỏi bạn lưu file là .html hay .php?
Logged

Hãy nắm tay cùng đưa ngày coder VN đi lên.
Cùng tạo nên chỗ đứng cho VN
Hãy bắt đầu điều đó tại đây:darkmovies.4vn.in bộ 4rom mã nguồn mở đầu tiên của VN
kizlove
PHP Starter
*
Posts: 1


Xem hồ sơ
« Trả lời #23 on: September 15, 2011, 03:00:31 AM »

hay qua thanks you
Logged
tan_wun
PHP Starter
*
Posts: 1


Xem hồ sơ Email
« Trả lời #24 on: December 14, 2011, 09:26:38 PM »

mấy anh ,chị trong 4r giúp em , em dò từng dòng code rồi nhưng mà vẫn ko hiện ra kết quả yêu cầu ... please..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
       
        $productname = $_POST['txtProductName'];
        $category = $_POST['txtCategoryName'];
        $sup = $_POST['txtSuplier'];
        $description = $_POST['txtDescription'];
        $price = $_POST['txtPrice'];
        $quantity = $_POST['txtQuantity'];
        $dberror = " ";
        $link = mysql_connect( "localhost", "root", "" );
        if ( ! $link ) {
                $dberror = mysql_error();
            }
            if ( ! mysql_select_db( "product", $link ) ){
                $dberror = mysql_error();
            }
            $query = "INSERT INTO product (ProductName,Category,Suplier,Description,Price,Quantity)
           values('$productname',' $category','$sup',' $description','$price','$quantity)";
        //print query

         print $query;
        if(!empty ($productname) && !empty ($category)){
             if ( !mysql_query( $query, $link ) ) {
           
                $dberror = mysql_error();

             }else{
                     print " thank you very much";
                  }
                }

        ?>
       
        <form name="AddItem" method="POST" action="<?php $_SERVER['PHP_SELF']?>">

        <table border="0">
            <thead>
                <tr>
                    <th></th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td> <h1> Main Form</h1></td>
                    <td></td>
                </tr>
                <tr>
                    <td>Product Name</td>
                    <td><input type="text" name="txtProductName" value="" /></td>
                </tr>
                <tr>
                    <td>Category Name</td>
                    <td><input type="text" name="txtCategoryName" value="" /></td>
                </tr>
                <tr>
                    <td>Suplier</td>
                    <td><input type="text" name="txtSuplier" value="" /></td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td><textarea name="txtDescription" rows="4" cols="4">
                        </textarea></td>
                </tr>
                <tr>
                    <td>Price</td>
                    <td><input type="text" name="txtPrice" value="" /></td>
                </tr>
                <tr>
                    <td>Quantity</td>
                    <td><input type="text" name="txtQuantity" value="" /></td>


                </tr>
            <table border="0">
                <thead>
                    <tr>
                        <th></th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><input type="submit" value="Add" name="Add" /></td>
                        <td><input type="submit" value="Cancle" name="Cancle" /></td>
                    </tr>

                </tbody>
            </table>

            </tbody>
        </table>
    </form>
    </body>
</html>
Logged
Trang: 1 [2]
  In  
 
Chuyển sang:  

Powered by SMF 1.1.15 | SMF © 2006-2007, Simple Machines . Modified by PHPVN Members