Hi as cereal been pointing out you just need to add your "phpmailer " /sending code on your form action like

<form action="phpmailer.php" method="post">

after that you need to pass the data from your form to the phpmailer.php script that you wrote like this

require 'PHPMailerAutoload.php';

//======= this is the data form your form====

$mail = new PHPMailer;
//$mail->SMTPDebug = 3;
$mail->Host = 'localhost';
$mail->SMTPAuth = true;
$mail->Username = 'reply_office@---.com';
$mail->Password = '---';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->From = 'reply_office@---.com';
$mail->FromName = 'Mailer';
$mail->Subject = 'Here is the subject';
$mail->Body    = 'My name is $name. you can send me an email at $email and visit my webpage at $website and my asdfghj is $query';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';


after you made the changes you are ready to Go.

can you run this script?

echo phpinfo();

please read http://php.net/manual/en/function.date-diff.php to better understand why you are getting that error message. Another thing your date_default_timezone is not correct please refer to this list for the correct timezone.

ronjacob012 commented: will help you as soon as possible +0

According to the php manual, date_diff is only available in PHP 5.3+ so thats why you are getting a fatal error. check the version of your php by echoing phpinfo();

please be more specific what error are you getting? the sample i gave you is working perfectly on my side without any glitch.

dont put your if statement in a straight line if you have a comment on it.

//send email 
//do nothing 


what error?

Your First script will work. you just need to make a cronjob for it to send the email automatically.

echo $diff->format("%a");


    //send email
    //do nothing

No its not. the pc needs to be turned on for the task scheduler to work. the best option you have is yo use a cronjob on your webserver that will check your script on a given interval of time.


First you must create a script that will check your DB if if the duedate is 2 days before. a simple select query will work.something like

SELECT * FROM table WHERE DATEDIFF(NOW(), duedate) < 2

if the statement return true add your send mail code.

for it to send the email automatically(without any user interactions/page load) you need something like task scheduler or much better a cronjob which will run your script on a specific interval of time.

hi check your form action you are sending your data in a .html file try making a .php file

you are assigning a number when you use = only. try Using == iN yOUr if statement not = like $row['roleID'] == 1

Hi one simple solution is use windows.confirm javascript just put your delete query inside the js like

    if (window.confirm('are you sure you want to delete this data?')) {

    .. your delete query    
    do anything

Hi you can use a condition statement inside your query that check whether your row contain the data that you wanna count..

  COUNT(DISTINCT CASE WHEN approved = '0' THEN  id END) 'zero',  
  COUNT(DISTINCT CASE WHEN approved = '1' THEN  id END) 'ones'
FROM business_details

Can you post the connection.php? also change $_POST['password'] to $_POST['n_password'] as password is not define


if(isset($_POST['old_password']) && isset($_POST['password']) && isset($_POST['new_password']))


if(isset($_POST['old_password']) && isset($_POST['n_password']) && isset($_POST['new_password']))

try removing ". sign on line 97 like this and retry

$change_pass = "UPDATE users SET user_pass = '$new_pass' WHERE user_name = '$_SESSION[user_name]'";

You need js to do it see this sample

there are really other way to do it. i just show you a simple solution. can you elavorate what your trying to achieve without using this and this. from what i understand you just wanna know what page send the contact info and when the info is emailed succesfully it will return to the form where the info originated.

hi you can use something like an identifier that will be send together with the data in contactsGo.php where you will use a simple IF statement to check if the data is from that specific form or not. and base on the IF Statement you can use a simple header redirect

something like

if ($identifier=="from_form1"){
 header("Location: form1.php")
header("Location: form2.php")

Hi as JorgeM said you need a js for it to be done...my suggestion is

  1. Full the data from your db and arrange it as you desire
  2. On page load use windows.print() or add a button or image that when click will call the print dialog box.


on page load


<body onload="window.print()">





or using an image or button





<img src="printer.png" width="28" height="28" onclick="window.print()" />

<input type="button" value="Print this page" onclick="printpage()">


When I hit the submit button, it just opens a window of coding

what do you mean by it..?you need to install first a server if your using windows you can try installing first xampp or wamp or lamp for linux base OS. you cant run anyserver side application without a server running on your system.

Hi just a thought try putting the $_SESSION['id']=$row['id']; inside the while statement in your first script.

Hi there are tons of good tut our there on d net regarding forms and email you just need to pick the simpliest one

heres a good sample


try not just to copy it but also understand whats the meaning of very line

also you need to configure first your php.ini if your working locally


hi first you need to change you form action

<form action="#" method="post" id="sendemail">

then can you show as your script on sending email as you've said you already have the script for it and by the way what you've posted is not yet the code its just markup..we need to see your actual script the one that will process all the data that the user inputted on your form.

Hi you can use google charts its easy to integrate to your php and mysql script as mmc told you need javascript to accomplish it although you can also use plane php to achieved it but i will not really recommend it..

i dont get what you're saying..if you just wanna retain the value of the textfield after submittion you just need to put in the textfield value like value="<?php echo "$tS"; ?>"

like this

 <input type="text" name="tString1" value="<?php echo"$ts"; ?>"/>

sorry but I don't get what does require_once("../includes/config.php");and require_once("../includes/dbconnect.php"); does. before what I learn is really basic. What is requires inside this includes?

to answer your question require_once is just the info of your database and server connection which is in your code the $conn = mysql_connect("localhost", "root", "") or die ("Could not connect to server"); and $db = mysql_select_db("Smartlocker", $conn) or die ("Could not connect to database"); part