movieprodw
asked on
Two buttons one form, php
Hello I am sending a form and I have two buttons, one is named email and the other send.
I then have a php file that the form posts to I need them to do different things.
Any ideas without java?
I then have a php file that the form posts to I need them to do different things.
Any ideas without java?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
first lets see whats wrong with your query run that and paste the mysql error.
include('db.php');
session_start();
$subject = 'subject';
$to = $_POST['email'];
$userid = $_SESSION['userid'];
$entry = $_POST['entry'];
$list_date = $_POST['list_date'];
if(isset($_POST['save'])){
mysql_query("update notes set entry='$entry', list_date='$list_date' where userid='$userid'")or die(mysql_error());
header("location:control_panel_notebook.php?msg=saved");
exit;
}
if(isset($_POST['email'])){
mysql_query("update notes set entry='$entry', list_date='$list_date' where userid='$userid'")or die(mysql_error());
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: email@email.com' . "\r\n";
$message = $message . "Below is your notebook entry from MySite.com:<br /><br />";
$message = $message . $entry;
$message = $message . "<br /><br />Thank you for using MySite.com for all of your real estate needs! <br />";
//echo("The value received is " . $to . "<BR>" . $subject . "<BR>" . $message . "<BR>" .$headers );
mail ($to, $subject, $message, $headers);
header("target: _self");
header("Location: control_panel_notebook.php?msg=Your entry has been sent to '. $to .'!");
exit;
}
mysql_close();
line 10 and 11 dont have ; on the end of the varibles
ASKER
nice catch krv123
I did fix those and when I run it it its does pick out the button and run the contents but it does not insert the data into the table, it will only send the emial, it just returns back to the page as it should
I did fix those and when I run it it its does pick out the button and run the contents but it does not insert the data into the table, it will only send the emial, it just returns back to the page as it should
try this and see if you get an error, if you do post it.
$sql = "UPDATE notes SET entry='$entry',list_date='$list_date' WHERE userid='$userid'";
$result = mysql_query($sql)or die(mysql_error());
if($result){
echo 'success';
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I still can not get it to work, they both send the email and do not save it?!
Open in new window