Hi,
I'm a novice with PHP so can anyone help me?
I'm trying to send the same form to two different places on submitting. Does anyone have an idea on what I can do? Thanks!
Derek
Hi,
I'm a novice with PHP so can anyone help me?
I'm trying to send the same form to two different places on submitting. Does anyone have an idea on what I can do? Thanks!
Derek
There is a way to do what you need, I'd think.
But we need to know a bit more.
Two places?
Emails? (Just use a comma between addresses)
PHP processing pages?
...that gets complex.
Options:
-open a second window, too, but that would be annoying as well as take some complex code, perhaps.
-use a php include to do the same function of the other page, if possible
-do one then the other, forwarding the posted data (could be hard, depending)
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
that doesn't always work well. if you are trying to send to your email and the senders / some input the user defines, you can use the header() function to CC: it.
now if you have more then 2 places, you can create an array of email addresses, then loop through the array to send to each email address seperately.PHP Code:// Get's the Message Ready
$to = "your_email@url.com";
$subject = "subject_of_email";
$message = "";
$user_email = $_REQUEST['email'];
// Sends Mail
mail($to, $subject, $message, "CC: $user_email")
PHP Code:$receipient[0] = "email1@address.com";
$receipient[1] = "email2@address.com";
$receipient[2] = "email3@address.com";
$receipient[3] = "email4@address.com";
$receipient[4] = "email5@address.com";
foreach($receipient as $add) {
mail($add; $subject, $message);
}
// Where subject and message are the same as format as defined in first example
commas are supported by the offical format of emailing.
Proper:
1@1.1, 2@2.2, 3@3.3
<name1> 1@1.1, <name2> 2@2.2
etc
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
I'm sorry, I knew after thinking about my post this afternoon I wasn't too specific.
Basically, the form is filled out and the directs you to your webmail account, but I also want the form to send the form's details to your mail.
Basically I have the PHP that sends the mail but my objective is this:
Send the mail silently, while displaying the page that logs you into the mail.
It all uses the same form so I would think it would be easy, and if the mail can't be sent "silently" I wouldn't care if like for example a pop-up came up saying "A copy of this form was sent to $email" or something along those lines.
If you still are confused please let me know...
Also I was thinking of ideas last night... If you know how to embed forms and have it do both objectives (1. redirect to webmail & 2. send a copy of the form to the person logging in) that way might work...
Also you may ask, why does an email have to be sent, I'd like the email to be sent so that we can determine if people are trying to compromise someones account using the webmail login form.
Please let me know if you have any ideas, thanks a bunch!
Also another idea, which I'm assuming is hard... but have the page that says "an email was sent to your account bla bla bla.." instead start redirecting you to the webmail page after sending the message, and have the webmail page use the information the form just sent to redirect you correctly... Let me know, although I'd prefer to just send the email silently and have the webmail sign the person in... Thanks
Arg sorry to keep editing! I actually found my solution! :-D woot! Searched on google: two actions one form, found this: http://www.webdeveloper.com/forum/sh...ad.php?t=89922 works great, i don't have to edit my PHP (which I'm terrible at) and can just use trusty good ol' frames... Woot! Sorry for troubling you all and wasting your time.... Thanks however, I'm glad you guys were there to spark my mind!
Last edited by allsims1; 05-21-2007 at 02:49 AM. Reason: an idea! ;-D (2nd edit, GOT IT! woot!)
what is the purpose of filling out an email form to then be directed to your mail account to have to fill it in again?
"silently" is all dependent on how the developer decides it to be. using the php mail script by default will be "silent" meaning that it wont give you a success / fail message on the screen unless you tell it to. If it does fail then it will be sent back to the server, but the developer would need to have access to the error log file which isn't web-accessible by default.
In most cases though it is a good idea to let the user know if the email has been sent or not, as a way of saying this thing actually worked... it can be very frustrating to users if they take the time to fill something out and try to send it and do not get a confirmation of some sort.
so your form is something that is going to log into a mail client? I am then assuming that the reason you want to have the email sent silently is because you would like to "hijack" the person's password? and it wouldn't matter if someone was trying to compromise the account because you are going to just see what is being entered. Unless you use some $_SERVER variables in the email to determine some other aspects of the communication
that will submit it to both the login of whatever mail client you are trying to get at, and it will send the details to some "process_to_email.php" that can be on your server.HTML Code:<form method="post" action="WEBMAILACTION" onsubmit="process_to_email.php"> ... </form>
Frames are not that great![]()
I agree about tracking the passwords. Not so nice, I'd say. But... depends. I'd suggest warning your users at least.
The main thing to realize here is that you don't need to send it two places but just alter the script to do two things. PHP isn't limited in how much it can do on a single page, so there's no reason you can't just do the first task, then the second, then be done, rather than routing through two pages.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Hijack the person's password? No, I'm not that good with PHP. But actually its a login form for my friends, its so we can login to gmail, our school blocks all https websites so gmail doesn't work, the technologist doesn't want to block gmail she told me, it's just that since everyone was bypassing the blocked websites by inserting the "s" after "http" so she had to block all https websites....
So anyway the login for logs you into a pop webmail server. And my friends and I said we wanted a copy of every login so we can see if some of the other students are trying to login to our accounts, since a lot of the kids are smart enough to probably "hijack" our passwords. We want it to be sent silently so then the hijacker doesn't know the login information is being sent to the account.
Also, I was being sarcastic when I said "good ol' frames" lol
Anyway, thanks a bunch for the help! However I'm flattered that you think I'm capable of "hijacking" accounts lol I wish I was that good with PHP. All I know is html and barely any php, well cya, thanks
there usually is a reason why system administrators block websites at schools.
but why would you send EVERY login to your email? that really just doesn't sound right. and if you know the mail() function in php then you can use it to send the information... heck I told you how in my reply how to use the mail function. Trying to bypass your school system is one thing, but tracking logins is something else entirely, and if caught you could be given some heavy punishment because you are not an administrator, and you are looking at passwords, so it could be perceive as malicious behavior, even if yo don't do anything, the perception of intent is there.
That IS tracking passwords.
A password is just sent to the next page. If you save that, then that's all you'd need to do. It's not hard. As such, you don't need any great skills if you have access to the page. I'd never trust a homemade rerouting thing to gmail.
On top of that, how does it work? https will still be used for gmail even if logged in. Perhaps you mean you're using a 3rd party pop3 email server?
I suppose it could work.
I'd also not want to give my teacher my password, so even if for 'good', I wouldn't trust that system, where she gets all the logins. That's a big invasion of privacy.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Bookmarks