PHP Code [Feedback & Upload Content]

4 05 2006

Today was my first lesson of php. I enjoyed it. Below is the PHP code that I learnt.

Email [feedback code]

<?php
//get post varibles and store them in local variables
$sender_name=$_POST['sender_name'];
$sender_email=$_POST['sender_email'];
$message=$_POST['message'];

$msg="email feedback form sent from web site\n";
$msg.="Sender's Name: $sender_name\n";
$msg.="Sender's Email: $sender_email\n";
$msg.="Message: $message\n\n";

//set up mail variables
$to="exxxxxx@bournemouth.ac.uk";
$subject="Web site feedback";
$mailheaders="From:My Web site\n";
$mailheaders.="Reply-To:$sender_email\n\n";

//send the email
mail($to, $subject, $msg, $mailheaders);

?>

Upload Content code [process file]

<?php
if($HTTP_POST_FILES['image_file']['size']<=0){
print"<h2>Your file was not received</h2><br>";
print"Either the file size was too big or<br>";
print"the file was larger than 125k.";
}else{
copy($HTTP_POST_FILES['image_file']['tmp_name'],
$HTTP_POST_FILES['image_file']['name']);
print"<h2> Thank you file has been received</h2>";
}

?>

Advertisements

Actions

Information

One response

7 05 2006
jemeehuang

very well .i almost wrote it down. thank you honey:) i already have mine : https://jemeehuang.wordpress.com/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s




%d bloggers like this: