*********Description of current situation**********
Here's what I've got:
1. an html form (form.html)
2. a php page (display.php)
3. another php page (mailit.php)
- In form.html the user inputs all sorts of data and then hits SUBMIT... the form uses the POST function to go to display.php --
display.php, using an "if (submit) == "Submit Info"";" statement then connects to the MySQL database and INSERTs the data.
display.php also displays the data on a webpage according to my html formatting by using <?PHP echo $Fieldname; ?> statements.
display.php also has an include line "include ('mailit.php');"
mailit.php is the script that will email the form data, formatted with the same html and echo statements
**********Description of what I want to change**********
Instead of automatically sending out an email via an "include" statement in display.php, I want to add links to display.php, giving people the choice of:
- - no email
- plain text email
- html email
***********My thoughts/questions***********
I'm guessing, from what I've read, that I probably need to use sessions, and/or reconnect to the database to retrieve the form data previously inserted.
Can I use one of the variables I collected through the form as my session ID? If so, how do I use this?
I've tried the following:
In display.php I've added:
Code: Select all
session_start();
$_SESSIONї"sessCust_Email"] = $Cust_Email;Code: Select all
// Open connection to the database
$connection = mysql_connect("localhost", "root", "xxxx") or die("Failure to communicate with database");
mysql_select_db('trimergence_free', $connection) or die(mysql_error());
//set up the query
$query = "SELECT * FROM trimerguserdata
WHERE Cust_Email='$_SESSION' ";
//run the query and get the number of affected rows
$result = mysql_query($query, $connection) or die('error making query');
$affected_rows = mysql_num_rows($result);
$Cust_Name = $affected_rowsї"Cust_Name"];
$Cust_Email = $affected_rowsї"Cust_Email"];
$Q1 = $affected_rowsї"Q1"];
$Q2 = $affected_rowsї"Q2"];
$Q3 = $affected_rowsї"Q3"];
$Q4 = $affected_rowsї"Q4"];
$Q5 = $affected_rowsї"Q5"];
$Q6 = $affected_rowsї"Q6"];
$Q7 = $affected_rowsї"Q7"];
$Q8 = $affected_rowsї"Q8"];
$Q9 = $affected_rowsї"Q9"];
$Q10 = $affected_rowsї"Q10"];
$Q11 = $affected_rowsї"Q11"];
$Q12 = $affected_rowsї"Q12"];Thanks,
Scott