ehpratah 48 Posting Whiz in Training

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

<?php
require 'PHPMailerAutoload.php';

//======= this is the data form your form====
$name=$_POST['name'];
$email=$_POST['email'];
$website=$_POST['website'];
 $query=$_POST['query'];
//===========end=======

$mail = new PHPMailer;
//$mail->SMTPDebug = 3;
$mail->isSMTP();
$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->addAddress('office@---.com');
$mail->isHTML(true);
$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.

ehpratah 48 Posting Whiz in Training

can you run this script?

<?php
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
ehpratah 48 Posting Whiz in Training

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();

ehpratah 48 Posting Whiz in Training

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

ehpratah 48 Posting Whiz in Training

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

if($diff=='2'){ 
//send email 
}else
{ 
//do nothing 
} 

?>
ehpratah 48 Posting Whiz in Training

what error?

ehpratah 48 Posting Whiz in Training

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

$currentdate=date_create("2014-06-15");
$duedate=date_create("2014-06-13");
$diff=date_diff($currentdate,$duedate);
echo $diff->format("%a");

if($diff=='2'){

    //send email
}else{
    //do nothing
}
ehpratah 48 Posting Whiz in Training

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.

ehpratah 48 Posting Whiz in Training

Hi

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.

ehpratah 48 Posting Whiz in Training
ehpratah 48 Posting Whiz in Training

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

ehpratah 48 Posting Whiz in Training

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

ehpratah 48 Posting Whiz in Training

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

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

    .. your delete query    
    }else{
    do anything
    }
</script>
ehpratah 48 Posting Whiz in Training

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

SELECT
  COUNT(DISTINCT CASE WHEN approved = '0' THEN  id END) 'zero',  
  COUNT(DISTINCT CASE WHEN approved = '1' THEN  id END) 'ones'
FROM business_details
ehpratah 48 Posting Whiz in Training

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

from

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

to

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

ehpratah 48 Posting Whiz in Training

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]'";
ehpratah 48 Posting Whiz in Training

You need js to do it see this sample

ehpratah 48 Posting Whiz in Training

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.

ehpratah 48 Posting Whiz in Training

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")
}
else{
header("Location: form2.php")
}
ehpratah 48 Posting Whiz in Training

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.

like

on page load

<html>
<head>

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

<?php

DATA FROM DB


?>

</body>
</html>

or using an image or button

 <html>
<head>

</head>
<body>

<?php

DATA FROM DB


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

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


</body>
</html>
ehpratah 48 Posting Whiz in Training

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.

ehpratah 48 Posting Whiz in Training

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

ehpratah 48 Posting Whiz in Training

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

http://www.freecontactform.com/email_form.php

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

http://roshanbh.com.np/2007/12/sending-e-mail-from-localhost-in-php-in-windows-environment.html

ehpratah 48 Posting Whiz in Training

hi first you need to change you form action

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

<form action="youraction.php" 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.

ehpratah 48 Posting Whiz in Training

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..

ehpratah 48 Posting Whiz in Training

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"; ?>"/>
ehpratah 48 Posting Whiz in Training

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