Web Analytics Made Easy -
StatCounter How can I add a confirmation box in this script ? - CodingForum

Announcement

Collapse
No announcement yet.

How can I add a confirmation box in this script ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I add a confirmation box in this script ?

    Hi,
    I have written a script that sends out emails to
    a list I have stored in a database.

    What is the best way to stop and ask if the user is sure
    that they want to continue ?

    Here is the portion of the script where ı would like to
    ask for confirmation:


    PHP Code:
    <div class="pg_whole">
    <span class="pg_head">Send Email to Members.</span>
    <?php
     
    // ask for confirmation

    $sql " SELECT * FROM clients WHERE type =  'm' AND confirm = 'y'";
    $result mysql_query($sql)    or die("could not execute find Clients query"mysql_error());  
    $num mysql_num_rows($result);
    if (
    $num ) {
    // Send out the emails
    Any thoughts on this ?

    Thanks
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #2
    Have you thought on showing a form where there is a "yes" and "no" button.

    The "yes" button is of submit type, and should submit the form which should do the processing of sending out the emails.

    Let me take for instance your script:
    PHP Code:
    <div class="pg_whole">
    <span class="pg_head">Send Email to Members.</span>
    <?php
     
    // ask for confirmation

    $sql " SELECT * FROM clients WHERE type =  'm' AND confirm = 'y'";
    $result mysql_query($sql)    or die("could not execute find Clients query"mysql_error());  
    $num mysql_num_rows($result);
    if (
    $num ) {
    // Send out the emails
    Would do it like this:
    PHP Code:
    <div class="pg_whole">
    <span class="pg_head">Send Email to Members.</span>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <strong>Do you really want to send email? </strong>
    <input type="submit" value="Yes" name="submit_email">
    <input type="button" value="No">
    </form>

    <?php
    if (isset($_POST['submit_email'])) {
    // Continue the processing of emails here
    // ask for confirmation

    $sql " SELECT * FROM clients WHERE type =  'm' AND confirm = 'y'";
    $result mysql_query($sql)    or die("could not execute find Clients query"mysql_error());  
    $num mysql_num_rows($result);
    if (
    $num ) {
    // Send out the emails
    Hope that makes sense.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

    Comment


    • #3
      just an

      Code:
      <a href="link" onclick="return confirm('are you sure you wish to do this?')">link</a>
      will do
      get up to 32 gigaytes free cloud storage at Dropbox

      For Tips on Runescape, Visit Marlaine's Musings

      Comment


      • #4
        Thanks very much
        for a clear and helpful answer
        If you want to attract and keep more clients, then offer great customer support.

        Support-Focus.com. automates the process and gives you a trust seal to place on your website.
        I recommend that you at least take the 30 day free trial.

        Comment

        Working...
        X