PDA

View Full Version : Nhờ code hộ, mình gà quá



chuongprocf
23-09-2009, 02:43 PM
MÌnh có 1 file Config thế này

<?php
$dbname = 'test';
$link = mysql_connect("localhost","root","123456") or die("Couldn't make connection.");
$db = mysql_select_db($dbname, $link) or die("Couldn't select database");
?>
Bạn nào giúp mình code cái file PHP tương tự như cái hình này với
http://i419.photobucket.com/albums/pp275/zxcasdzxc/untitled-34.jpg
Backgroup màu gì cũng dc và khi nhấn Send sẽ ghi vào database đã khi báo ở Config các nội dung trên vào 1 table report
Thank các bạn nhé, mình gà PHP quá

boyvt
24-09-2009, 11:22 AM
Bạn xem thử hướng dẫn này rồi apply vào:
This tutorial require 1 PHP file and 1 table of mySQL database.

1. email_to_multiple.php
2. Database "tutorial" and table "email_list" with 3 fields: id(auto_increment), name(varchar, 50), email (varchar, 50) and put some records into this table. (directly by phpMyAdmin) as below;


<?
// Check, if submitted.
if($Submit){

// Get variables from POST method form.
$subject=$_POST['subject'];
$note=$_POST['note'];

$sender="webmaster@localhost"; // Your Email here.

echo "Email has been sent to:";

// Connect database
mysql_connect("localhost","","");
mysql_select_db("tutorial");

$rs=mysql_query("select * from email_list order by id asc");

// Do while loop to send email.
while($row=mysql_fetch_assoc($rs)){
$to=$row['email'];
$mail_from="From:$email n";
$mail_from .="Content-Type: text/html; charset=utf-8 n";

mail($to,$subject,$note,$mail_from);

// Show sent emails.
echo "$row[email]<br>";
}
}else{

// Do following codes if not found "Submit" value.(Not submitted)
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form action="<? echo $PHP_SELF; ?>" method="post" name="form" id="form">
<table>
<tr>
<td align="right">Subject : </td>
<td><input name="email" type="text" id="email" /></td>
</tr>
<tr>
<td align="right" valign="top">Note : </td>
<td><textarea name="comment" cols="60" rows="5" id="comment"></textarea></td>
</tr>
</table>
<input type="submit" name="Submit" value="Send Email" />
</form>
</body>
</html>
<? } ?>

hackerstudent
24-09-2009, 02:50 PM
Mình thấy code của boyvt cũng được đấy. Nhưng mình thấy còn thiếu mấy cái như Điện thoại, Liên lạc lại theo; Nếu mà bạn chuongprocf muốn làm mấy phần trên thì bạn nên nói rõ hơn mấy phần đó lấy dữ liệu trong database hay là dùng HTML trực tiếp để chúng tớ còn giúp.

chuongprocf
26-09-2009, 09:37 AM
Bay giờ mình muốn đọc cái database đã làm ra tương tự http://cuasotrithuc.net/sms/vip.php thì phải làm sao ạ