aej1973
asked on
send a link to a from via email...?
Hello,
I am building an application that requires an agent to fill an approval request form ( has about 3 fields ) and when the agent hits the submit button an email will need to be sent with the link to the form to the approving supervisor. When the supervisor clicks on this link a small form opens up (with the data the agent has entered) and the supervisor will need to click the approve/deny button and submit the form. When the form is submitted the database gets updated with the result. Is this possible to do? Can someone let me know how this can be done? Thank you.
A
I am building an application that requires an agent to fill an approval request form ( has about 3 fields ) and when the agent hits the submit button an email will need to be sent with the link to the form to the approving supervisor. When the supervisor clicks on this link a small form opens up (with the data the agent has entered) and the supervisor will need to click the approve/deny button and submit the form. When the form is submitted the database gets updated with the result. Is this possible to do? Can someone let me know how this can be done? Thank you.
A
ASKER
Thank you. I have created the form where I enter the details. The way it is set up now is that once I hit the submit button the db gets updated and an email with the form details get set out. The php script for the email module is attached. How do I modify this to send just the link with the details?
Also, I created the form and am able to pull the data from the form fields. When this form is created and unique ID corresponding to this record is created in the DB. When I send the link the link should correspond to this unique record. How do I do this?
Thank you for the help.
A
Also, I created the form and am able to pull the data from the form fields. When this form is created and unique ID corresponding to this record is created in the DB. When I send the link the link should correspond to this unique record. How do I do this?
Thank you for the help.
A
$recipients=array("someone@somewhere.com");
for($i=0; $i<sizeof($recipients); $i++) {
$rpath=$recipients[$i]; $bcc="Bcc: $bcc";
$subject="Email Link Test....";
$body = "The billing team requests you to approve the following subscriber's credit request: ";
$body=$body."\r\n\r\nAccount Number: ".$tempid."\r\n Request date: ".$tempdate."\r\n Requested Amount: ".$tempamt;
$body=$body."\r\nReason for this credit: ".$tempreason."\r\nRequesting Agent: ".$tempcsr;
$body=$body."\r\nComments: ".$tempcomments;
mail("$rpath","$subject",$body,"From: Manage My Team <$rpath>\r\n$bcc","-f$rpath");
}
?>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thank you, that worked. Would you by any chance know how I an make the link open up as a pop up?
Assuming you mean popup as in javascript then no, this wouldn't be possible via email as far as I know.
ASKER
Thank you.
Short explanation:
You create a form that will create a record in a database and send an email pointing to another page that will display that record. On that page, you will create two buttons (approve and deny) and when the supervisor submits it, it will update the record.
Long explanation:
Create a page called form.php with your form on it.
One submit, call a script like this:
<?php
// get and secure POST data
// submit to database with flag "unapproved" or "awaiting approval" or set a field called "approved" with an initial value set to NULL or "No" or 0 (zero).
// send email with ID in URL, your URL will look like this:
http://www.mywebsite.com/approve-form.php?form_id=1000
?>
Then, create another page called approve-form.php (password protected) where your supers can approve a form. Have this page run a script like this:
<?php
// get and secure GET data
// this script will call the form based on the ID passed via the URL; i.e. your URL will look like this:
http://www.mywebsite.com/approve-form.php?form_id=1000
?>
When the user submits this form (approve or deny) it will update the record accordingly.