Jump to content

Recommended Posts

Hi all..

 

i have no idea of javascript.. i developed a small application in php.. for the front end validation, i used some small codes of javascript (i picked from google ).. i need a few things related to javascript..

 

1. i wanted to check if the input in a textbox is in the format  'OJT_001'

2. if the input of a textbox contains only alphabets ..

3. i have also  added  front end validation in php in my code.. so when showing the error messages, both javascript error popups and php error messasages are being shown ..i donot want php error messages, when javascript popups are being shown.. i added php validation , in case javascript is turned off in the browser..

 

please help me out with this..

 

please suggest me some good tutorials of javascript which offer many example codes..

 

thank you...

sania..

Link to comment
https://forums.phpfreaks.com/topic/54421-urgent-help-needed/
Share on other sites

it's best to use javascript as little as possible, due to compatibility with browsers.

Theres a lot of simple methods for checking inputs using just php.

 

I'd suggest ereg for checking what you want..

<?php
if(!ereg('^([A-Z]{3}.[0-9]{3})$', $value)){
   //throw up an error
}else{
    //format is correct
}
?>

That will check the textbox contains 3 capital letters, followed by a puncuation of some sort, then 3 numbers.

 

<?php
if(ereg('^[A-Za-z]+$', $value)){
   //throw up an error
}else{
    //format is correct
}
?>

if it's only letters it gives an error

 

there's a start for you

Link to comment
https://forums.phpfreaks.com/topic/54421-urgent-help-needed/#findComment-269108
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.