Results 1 to 4 of 4

Thread: Background sending of php mail

  1. #1
    Join Date
    Feb 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Background sending of php mail

    Hi guys,

    I'm new to all this so I really need some advice!!

    I am doing up a data entry page for events, by clicking on 'submit', the data will be uploaded into the mysql database. All this poses no problem, but I need to create a php mail (mail.php) that upon clicking on 'submit' (events.php), an email will be sent to a colleague to tell her to go to this admin page which I have done up for her to approve or disapprove the event submission.

    As far as I know, 'submit' is only for the event form and not for the mail.php. But it would be stupid to put two buttons on the events.php...

    What should I do??

  2. #2
    Join Date
    Feb 2006
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    If you merge both pages so that after the information is entered into the database the email is send afterwards:

    Pseudo code:
    IF SUBMIT CLICKED
    ENTER EVENT INTO MYSQL DATABASE
    SEND EMAIL

  3. #3
    Join Date
    Feb 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Pixelcode
    If you merge both pages so that after the information is entered into the database the email is send afterwards:

    Pseudo code:
    IF SUBMIT CLICKED
    ENTER EVENT INTO MYSQL DATABASE
    SEND EMAIL
    Hi! Thanks for your reply!! May I know what I should put?
    - event.php: the form
    - eventdata.php: the php file to insert info into the database
    - mail.php: contains mail() to send email reminder.

    Imagine an html form on event.php, and the submit button is only for submitting the info on the event, not for processing mail.php...

    <form method="POST" action="eventdata.php">
    blah blah blah event details....
    <input type="submit" value="Submit">
    </form>

    My only solution is to put if event is sucessfully submitted, then the mail.php would be run, bow WHERE and HOW do I do it in the following? Can someone help me with the code?

    if ($eventsent) {
    echo "The submission has been successful.";
    }
    else {
    echo "There was an error sending this data. Please retry";
    }
    ?>

  4. #4
    Join Date
    Feb 2006
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    event.php

    Code:
    <form method="POST" action="eventdata.php">
    blah blah blah event details....
    <input name="Submit" id="Submit" type="submit" value="Submit">
    </form>
    eventdata.php

    PHP Code:
    if($_POST['Submit']){  //if submit is clicked
    //check data
       
    if ($eventsent) {
           
    //enter data into mysql
           
    include_once("mail.php"); //run mail.php
           
    echo "The submission has been successful.";
       }else {
           echo 
    "There was an error sending this data. <a href=\"#\" onclick=\"javascipt:history.go(-1)\">Please retry.</a>";
       }

    Last edited by Pixelcode; 02-27-2006 at 05:13 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •