1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MsgBox with PHP !!!

Discussion in 'PHP' started by pulikuttann, Mar 29, 2007.

  1. #1
    Is it possible to create a msgbox with php ???
    SEMrush
    I want to check the matching of two password fields and display a msgbox with "password not match" !!!
     
    pulikuttann, Mar 29, 2007 IP
    SEMrush
  2. ServerUnion

    ServerUnion Peon

    Messages:
    3,615
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes, you can do it by printing out javascript code. A google search will give you some great examples. javascript:alert('text here');
     
    ServerUnion, Mar 29, 2007 IP
  3. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you want to do it within the page you can modify the innerHTML of a div or use a text input field set to readonly which displays the alert.
     
    streety, Mar 29, 2007 IP
  4. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #4
    do it like this in php:

    if($pass1 != $pass2){
    echo "<script>alert(\"The two password did not match.\");</script>";
    }
     
    srobona, Apr 3, 2007 IP
    vegabond likes this.
  5. DomainerHelper

    DomainerHelper Well-Known Member

    Messages:
    445
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    100
    #5
    That won't work right. You want it to show prior to them leaving the form. The above post will show it after submitting and leaving the page.

    Google this term:
    javascript form validation -jquery
    Code (markup):
    It will give you a lot of resources.

    This looks like your best bet:
    http://www.tutorialspoint.com/javascript/javascript_form_validations.htm

    However, you will also want the PHP version for those with Javascript disabled. An example for your parse page:

    
    <?php
    if (empty($_POST['password']) || empty($_POST['passwordconf'])) {
        echo 'You left a field blank. <a href="#">Go back...</a>';
    } else {
        if ($_POST['password'] != $_POST['passwordconf']) {
            echo 'The passwords do not match. <a href="#">Go back...</a>';
        }
    }
    ?>
    
    Code (markup):
    Never trust in Javascript.
     
    Last edited: Sep 9, 2015
    DomainerHelper, Sep 9, 2015 IP