Error messages when entering data

Discussion in 'PHP' started by ghjk, Mar 28, 2008.

  1. #1
    I have two questions.
    1.I have to enter values to database through php. When I enter incorrect value, it gives the error message. But i want to give it as a pop up message. how can i do that?

    2. If I enter incorrect value and after the pop up message comes , I want to details that i entered earlier are exist. Otherwise I have to enter all these again. How can i do that?
     
    ghjk, Mar 28, 2008 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    Well, you can get error message using this function:
    
    $errormessage = mysql_error();
    
    PHP:
    I suppose you are using MySQL.
    Popping it is html/javascript question.

    If you want to save data that was entered you have to put values to input fields of form using $_GET or $_POST array.
     
    AsHinE, Mar 28, 2008 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    Easy. In the form use:

    <form target="_blank">
    form stuff
    </form>

    Then in the target page, you can throw the error off to the user, otherwise close the window.

    Another thing toy can do is onclick submit the form to a specific size and get the values using parent get variables.

    Peace,
     
    Barti1987, Mar 28, 2008 IP
  4. roshanbh

    roshanbh Peon

    Messages:
    52
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    well..you can use javascript within php to and use alter to show popup message.....
     
    roshanbh, Mar 28, 2008 IP
  5. singh.ajit05

    singh.ajit05 Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you can use something like that.......

    echo "<script>alert('plese enter correct value');</script>";

    in a exact postion to use it..
     
    singh.ajit05, Mar 29, 2008 IP