Hi,
The question is regarding PHP and Javascript/Jquery.
I have a php page which process the form data and displays it on SUBMIT.
I need to collect that data into javascript.
how should I proceed?
//Php file
<?php
@session_start();
$uname = $_SESSION['sessionVar'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Selected Details for E-mail</title>
// To pop-up the outlook & send the mail
<script type = "text/javascript" src = "script/mail.js"></script>
<script type="text/javascript">
$(function () {
$('.btnSendEmail').click(function (event) {
var email = 'sendermail@email.com';
var subject = 'sender Subject';
var emailBody = 'body';
//here in EmailBody I want to print the data collected from the page
window.location = 'mailto:' + email + '?subject=' + subject + '&body=' + emailBody;
});
});
</script>
</head>
<body bgcolor = #B0D1F3>
<br /><br/>
User <b><?php echo $uname;?></b> has requested to refresh <b><?php echo $_POST["name"]; ?></b> with <?php
if(!empty($_POST["list"])) {
$snapname = $_POST['list'];
echo "snapname :<b> ".$list." </b><br/>";
}
else {
echo "<b>Please Select the list items.</b>";
}
?><br/>
With following Commands:
<?php
if(isset($_POST['submit'])){
if(!empty($_POST['instance'])) {
$checked_count = count($_POST['instance']); // Counting number of checked checkboxes.
echo "(You have selected following) <b>".$checked_count."</b> option(s): <br/>"; // Loop to store and display values of individual checked checkbox.
foreach($_POST['instance'] as $selected) {
echo "<p><b>".$selected ."</b></p>" ;
}
}
else{
echo "<b>Please Select Atleast One Option.</b>";
}
}
?>
<div>
<INPUT Type="button" VALUE="Back" onClick="history.go(-1);return true;">
<button class="btnSendEmail">Send Email</button><br /><br />
// on click of Send Email button, it gives me the outlook and body should contain the data on that page which is processed from prvious page
</div>
</body>
</html>