#1
|
||
|
phmailer Problems When Embedded in a Page
I embedded phmailer in an HTML page. Everything works flawlessly, with one exception. When I try to submit an E-Mail that has an incomplete field or other error it amends the page and shows that I have errors in a big red text, but it navigates away from the page and goes to the phmailer.php file to do so. I poked and prodded to try to figure out what makes this tick; it all seems like magic to me.
What I'd like it to do is just use JavaScript alert to tell the submitter there's a problem, without navigating away (I'm not sure how it works, but I think it tries to reload itself). I can get the alert down, but it still moves from the current page to just the lone php page. If I'm explaining this poorly please let me know. My code is a mess and all over the place. The phpmailer page has not been greatly altered though. |
#2
|
||
|
How did you embed it? Did you just copy the phMailer form html and then direct your form to phMailer.php? Or did you use a frame or what? A link would help.
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#3
|
||
|
I can't seem to find the exact page, but I was looking around for ways to embed a PHP page into an HTML page. I know there are better, more orthodox ways of doing these things, but I'm no pro - I like to just tinker. Someone wanted to put a PHP-based clock into their page and I adapted that to load the mailing form. Basically it used JavaScript to run a function that loads the page into a div.
Here's the JS code: Code:
var urlForPHP = "test.php"; var idForReplace = "contact-area"; var xmlhttp; function reloadPHP() { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your Browser does not support HTTP Request"); return; } var url=urlForPHP; url=url+"?random="+Math.random(); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById(idForReplace).innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } Maybe it's this code that's doing it. |
#4
|
||
|
That is a tricky one. More than likely, when you load up the php form in your html page, it does not refresh the DOM with the phMailers JavaScript. If you take out the JavaScript in my form and include it on the HTML page, it might work. However, for errors such as wrong file types and uploaded files being to big, it will still have the red text because JavaScript is only client side so it does not know the response of the server.
Maybe you could use a inline frame? Or change the HTML within the phMailer file to reflect your websites design.
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PhMailer: help | xist | phphq.Net Forums | 0 | 05-19-2008 04:07 PM |
phMailer | k1200lt | phphq.Net Forums | 4 | 12-11-2007 12:02 AM |
Open text from page in another page | katana*GFR* | Web design and Programming | 21 | 07-21-2005 10:28 AM |
<Previous page 1 2 3 4 5 6 next page> script | big n00b at php | phphq.Net Forums | 4 | 03-11-2005 12:35 PM |
embedded animated sigs??? | BOne | Sigs and Graphics | 5 | 09-28-2004 06:37 PM |