View Full Version : HTML/PHP Form
Hello everyone!
I was looking for a form that will let the user submit the location of an iframe (on the same page) to mein an email.
Any Ideas???
you mean the iframe source?
Is it always one/several urls, or could it be any url (user-determined)? Do you want them to enter the url manually or simply submit the form and it would determine the url automatically?
Yeah, it should submit the url automatically. I plan on using this for people wh need to report an error on my site.
how is the iframe source set? If it's set by a button, link, or referrer, you could use the same method to POST it via a hidden form and send the email from there. Otherwise, you'd have to use something like jQuery to find the iframe source. Javascript is not my strongest suit, but if you post your code I'd be happy to help you figure it out.
Here's the code:
<form><input type="submit" value="Report Broken Page"></form>
<br><br>
<iframe src="page-name.html" height=500 width=550 frameborder=0></iframe>
if there could be an alert box before it sends the email to say 'Duble check your browser first' or something like that...
here's the question we need answered: what determines the source of the iframe ( src="page-name.html" )? Is that always the same or is it sometimes "otherpage-name.html" or is there some way to allow the user to choose a page ( "whateverpageIlike.html" )? How is the source set?
Yes, the iframe src changes, a lot. that's the point of the script: and error reporter
JShor
08-31-2009, 05:35 AM
Then get the source of the current SRC of the iframe.
<?php
if(isset($_POST['submit'])) {
$to = "someone@example.com";
$subject = "Iframe source";
$message = $_POST['hidden'];
$from = "someonelse@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail successfully sent";
}
?>
<script type="text/javascript">
function sendSource() {
var source = document.getElementById('sourceFrame').document.body.innerHTML;
var hidden = document.getElementById('hidden');
hidden.value = source;
}
</script>
<iframe src="blah blah" id="sourceFrame"></iframe>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="hidden" value="hidden">
<input type="submit" name="submit" value="Send Mail!">
</form>
Make changes to fit your needs.
HTH:)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.