Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

javascript alert message in php file

miryellismiryellis Posts: 3Member
I'm a little confuse in calling out my javascript alert message.
I tried using few method still it doesn't work.

Right now I'm coding on the registration form.
It suppose to validate my password and confirm password with a limit of 5-8 char (1 alpha & 1 num a must).

1)Earlier I did code it in javascript for my password & confirm password fields (password.js) leaving user, address, etc still in php file.

Tried using include & require in my php to link to my password.js it does not work.

2)Instead I re-coded it and used an alert in my php just to prompt an error if user keyed in invalid password. It gives me fatal error!

Now, what I want is actually to have an error message prompted in my php code. To warn user that the password and the confirm password is wrong if
1) Not the same
2) Does not contain at least 1 alpha or 1 num.

Anyone could help me with this?
I'm so new to JavaScript and PHP.

Comments

  • ManningManning Posts: 1,621Member
    : I'm a little confuse in calling out my javascript alert message.
    : I tried using few method still it doesn't work.
    :
    : Right now I'm coding on the registration form.
    : It suppose to validate my password and confirm password with a limit of 5-8 char (1 alpha & 1 num a must).
    :
    : 1)Earlier I did code it in javascript for my password & confirm password fields (password.js) leaving user, address, etc still in php file.
    :
    : Tried using include & require in my php to link to my password.js it does not work.
    :
    : 2)Instead I re-coded it and used an alert in my php just to prompt an error if user keyed in invalid password. It gives me fatal error!
    :
    : Now, what I want is actually to have an error message prompted in my php code. To warn user that the password and the confirm password is wrong if
    : 1) Not the same
    : 2) Does not contain at least 1 alpha or 1 num.
    :
    : Anyone could help me with this?
    : I'm so new to JavaScript and PHP.

    Sounds like you're wanting to mix JavaScript and PHP code? There's no real easy way to do it, and usually no reason to either. One is a server side technology, and the other client side. So they complement each other nicely (what one can't do, the other usually can), but they just dont interact.

    If you could post the relevant parts of your code, maybe someone can make suggestions.
Sign In or Register to comment.