Airtel 3G latest hack for March April

Get every trick latest in advance by becoming a member of my blog.

Yes, you can be someone special,who get all ticks before audience, what you need to do is to follow some simple steps and terms and conditions, Click here to know more. Hurry, once all the state members are completed, this post will automatically be titled as Expired or Done. Last date will be posted before 30th May 2013
Naveen jain
Showing posts with label php tutorial. Show all posts
Showing posts with label php tutorial. Show all posts

Sunday, 10 June 2012

php basics - echo

Posted by Unknown on 16:09 with No comments

This is a good tutorial for basic php. This tells about a function echo.
<?php
echo "";

?>
"" can contain string and will show correct value, whereas '' will show string name, and use \n to leave ' or ".

Thursday, 7 June 2012

How to create a contact me form in php

Posted by Unknown on 17:50 with No comments

You not need to change the coding below, just change the value of $email to own email. This form will send you a email at $email(Value you fixed) address
<?php
error_reporting (E_ALL ^ E_NOTICE);

?><!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>Contact form</title>
</head>

<body>
<?php
if ($_POST['submit']){
         $email = "admin@naveenjain.webatu.com"; // enter your own email 
$n = $_POST['name'];
$e = $_POST['email'];
$t = $_POST['telephone'];
$c = $_POST['country'];
$ci = $_POST['city'];
$a = $_POST['address'];
$comment = $_POST['comment'];
if ($n){
if ($e){
if ($t){
if ($c){
if ($ci){
if ($a){
if ($comment){

$webmaster = "$email";
$headers = "From: $n<$webmaster>";
$subject = "Mail from contact form";
$message = "You have got a mail from $n.<h2>User's Details</h2> <br />User's email is $e. Telephone number is $t. Country is $c and city is $ci and address is $a. His comment was $comment";
if (mail($e, $subject, $message, $headers)){
echo "Your message has been sent";

}
else
echo "Sorry, the message could not be sent please try again after sometime";


}
else
echo "enter your comment";




}
else
echo "Enter your address";


}
else
echo "enter your city";

}
else
echo "enter your country";

}
else
echo "enter your telephone";
}
else
echo "enter your email";



}
else
echo "Enter your name";

}
else
echo "<form action='' method='post'>
<table>
<tr>
<td>Name</td>
<td><input type='text' name='name' /></td>
</tr>
<tr>
<td>Email</td>
<td><input type='text' name='email' /></td>
</tr>
<tr>
<td>Telephone</td>
<td><input type='tel' name='telephone' /></td>
</tr>
<tr>
<td>Country</td>
<td><input type='text' name='country' /></td>
</tr>
<tr>
<td>City</td>
<td><input type='text' name='city' /></td>
</tr>
<tr>
<td>Your address</td>
<td><textarea name='address'></textarea></td>
</tr>
<tr>
<td>Comment</td>
<td><textarea name='comment'></textarea></td>
</tr>
<tr>
<td></td>
<td><input type='submit' value='Send us query' name='submit' /></td>
</tr>

</table></form>";

?>
</body>
</html>

Wednesday, 25 April 2012

First of all you need to create a index.php file and a database of 4 columns which are -
1.id (BIGINT)(index = primary) AUTO INCREMENT = true
2.name (VARCHAR 250 characters)
3.message (VARCHAR 250 characters)
4.email (VARCHAR 250 characters)
Then in index.php file write the following codes to show the guestbook-


<!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>Guestbook - home</title>
</head>
<body>
<?php
// echo all the database data
require ("connect.php");
$q = mysql_query("SELECT * FROM guestbook ORDER by id desc");
$num = mysql_num_rows ($q);
if ($q > 0){
while ($data = mysql_fetch_assoc ($q)){
$name = $data['name'];
$message = $data['message'];
$email = $data['email'];
echo "<div style='background-color:yellow'>$name says <br> $message. <a href='mailto:$email'>Mail $name</a>. <a href='report.php'>Report spam and delete</a></div><hr />";
}

}

?>
</body>
</html>



Now create connect.php file with following code-

<?php
mysql_connect ('localhost','root','naveen');
mysql_select_db ('tutorials');

?>
Now insert anything in database and you can see it working.