PDXDesigner Posted June 2, 2007 Share Posted June 2, 2007 Hello, First off I would like to say that I am not a programmer. I am mainly a designer, although I do know JavaScript well, except that I am using a HTML/PHP form on a website I am doing. The form works and it even redirects to the correct page. However, instead of redirecting to a new page I would like it to call a popup window (600px x 400px)but leave the page that the form is on open so when they close the popup window the page is still there. If anyone can help that would be great! I have scoured Google and other forums with no help. The codes to redirect after validation is below: # Redirect user to the error page if ($ValidationFailed === true) { header("Location: http://www.craigperry.com/newsite/consultation_Error.htm"); exit; } The entire Code is below: <?PHP error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('track_errors', true); function DoStripSlashes($FieldValue) { if ( get_magic_quotes_gpc() ) { if (is_array($FieldValue) ) { return array_map('DoStripSlashes', $FieldValue); } else { return stripslashes($FieldValue); } } else { return $FieldValue; } } #---------- # FilterCChars: function FilterCChars($TheString) { return preg_replace('/[\x00-\x1F]/', '', $TheString); } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ClientIP = $_SERVER['REMOTE_ADDR']; } $FTGname = DoStripSlashes( $_REQUEST['name'] ); $FTGemail = DoStripSlashes( $_REQUEST['email'] ); $FTGphone = DoStripSlashes( $_REQUEST['mainphone'] ); $FTGphone = DoStripSlashes( $_REQUEST['alternatephone'] ); $FTGcity = DoStripSlashes( $_REQUEST['city'] ); $FTGstate = DoStripSlashes( $_REQUEST['state'] ); $FTGnotes = DoStripSlashes( $_REQUEST['notes'] ); # Redirect user to the error page if ($ValidationFailed === true) { header("Location: http://www.craigperry.com/newsite/consultation_Error.htm"); exit; } # Email to Form Owner $emailSubject = FilterCChars("Free Consultation Information"); $emailBody = "name : $FTGname\n" . "email : $FTGemail\n" . "mainphone : $FTGphone\n" . "alternatephone : $FTGphone\n" . "city : $FTGcity\n" . "state : $FTGstate\n" . "notes : $FTGnotes\n" . ""; $emailTo = 'Steve <steve@pdxdesigner.com>'; $emailFrom = FilterCChars("$FTGemail"); $emailHeader = "From: $emailFrom\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"ISO-8859-1\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Redirect user to success page header("Location: http://www.craigperry.com/newsite/consultation_thankyou.htm"); exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/53950-how-to-have-a-popup-window-show-when-php-form-is-validated/ Share on other sites More sharing options...
tail Posted June 2, 2007 Share Posted June 2, 2007 put this in your <head> <SCRIPT TYPE="text/javascript"> <!-- function popup(mylink, windowname) { if (! window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; window.open(href, windowname, 'width=400,height=200,scrollbars=yes'); return false; } //--> </SCRIPT> then use this in your if statement: if ($ValidationFailed === true) { echo '<script>return popup(this, 'notes')</script>'; } Quote Link to comment https://forums.phpfreaks.com/topic/53950-how-to-have-a-popup-window-show-when-php-form-is-validated/#findComment-266729 Share on other sites More sharing options...
PDXDesigner Posted June 2, 2007 Author Share Posted June 2, 2007 Thank you tail. Do you know if this will work if I call the javascript from an external .js file? Also would it be similar for the Thank You page as well: # Redirect user to success page header("Location: http://www.craigperry.com/newsite/consultation_thankyou.htm"); exit; Ok, now this may seem retarded, but within the JS Script you sent is the mylink suppose to be the link to the popup page I want? Quote Link to comment https://forums.phpfreaks.com/topic/53950-how-to-have-a-popup-window-show-when-php-form-is-validated/#findComment-266731 Share on other sites More sharing options...
tail Posted June 4, 2007 Share Posted June 4, 2007 http://www.htmlcodetutorial.com/linking/linking_famsupp_89.html Quote Link to comment https://forums.phpfreaks.com/topic/53950-how-to-have-a-popup-window-show-when-php-form-is-validated/#findComment-267880 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.