troubleshooting Question

Programming (php, Javascript) not working

Avatar of Richard Korts
Richard KortsFlag for United States of America asked on
8 Comments1 Solution88 ViewsLast Modified:
I have this code in program 1:
<!DOCTYPE html>

<title>Print Single Form</title>
<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="//">

    <script src=""></script>
    <script src=""></script>

    <script src="//"></script>
    <script src="//"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">

    <title>Backflow Assembly & Test Report Form</title>
        .nopadding {
            padding: 0 !important;
            margin: 0 !important;
        .wrapper {
            max-width: 767px;
            min-width: 480px;
            margin: 0 auto;
	user = <? print $_SESSION['user']; ?>;
	fname = "<? print $fname; ?>";
	ac = "";
	fr = "<? print $fr; ?>";
	ems = "<? print $_GET['ems']; ?>";
	loc = "<? print $loc; ?>";
	function open_pdf_win() {
		str = loc + fname;;
	function ask_email() {
		jj = confirm("Email printed form to my email?");
		if (jj) {
			window.location = "email_pdf_new.php?f=" + fname;
		window.location = "print_cleanup.php?fr=" + fr + "&ems=Y";
	<body onLoad="open_pdf_win(); ask_email();"> 
	<? if ($_GET['ems'] != "y") {?>
		<body onLoad="ask_email();">
	<? } ?>	

It displays the confirm, I answer yes.

Unless I'm missing something basic (maybe I am), it goes to email_pdf_new.php.

Code for that is this:

//echo "entered email_pdf_new<br>";
// email_pdf.php
// use phpmailer
$f = $_GET['f'];
if ($_SESSION['user'] == 2) {
	echo "entered email_pdf_new<br>";
	echo "file = " . $f . "<br>";
$mail             = new PHPMailer(); // defaults to using php "mail()"

$mail->isSMTP(); // telling the class to use SMTP transport
$body             = "";
$mail->SMTPSecure = $GLOBALS['smtp_security'];
$mail->Port       = $GLOBALS['smtp_port'];
$mail->Subject   = "Completed form for " . $_SESSION['pn'];
$body = "Attached is the completed form for the subject property";
$mail->AltBody = strip_tags($body);
if(!$mail->Send()) {
	echo "Mailer Error: " . $mail->ErrorInfo;
} else {
	//echo "sent email";
	//echo "going to choose_cust_new<br>";
	if (isset($_SESSION['narrow'])) {
		if ($_SESSION['narrow'] == "yes") {
			header("Location: choose_cust_ph.php?prop=" . $_GET['prop']);
	} else {	
		header("Location: choose_cust.php?prop=" . $_GET['prop']);
	//echo $loc;

I am user where $_SESSION['user'] = 2. The echos do not display, which implies, it does not enter this program.


David S.
Consultant & Challenge Subduer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2009

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros