Help PHP form, Input type for Mobile Number.

Status
Not open for further replies.

Rahul++

Inactive
Galvanizer
Hey,
I am making Contact us page for one friend.

I want only Numbers in this code -
Code:
<div class="row"><label for="telephone">Mobile: </label><input name="mobile" type="text" id="mobile" size="20" value="<?php if(isset($_POST['mobile'])){echo $_POST['mobile'];} ?>" /></div>

But it allow to insert text.. :( any experts, help please.
 
You can use javascript for checking the field

use onChange function to check for alphabets and prompt the user accordingly
 
java/javascript are very different

if you want to do web designing...js is a important point....java can be skipped

google for sample code for onchange
 
  • Like
Reactions: 1 person
jQuery -- for IE...

JQuery as a framework is very nice but with IE it sux real badly, thats why i would prefer extjs over it anyday :D
 
jQuery is cross browser compatible. You need to check your own javascript for compatibility with IE. You can't deny the jQuery's compatibility, that is why Drupal includes it in it's core.

Moreover, extjs is in quite different arena than jQuery.
 
ultra vires said:
I have been using jQuery for the past 1 year. :\

There are fixes that take into account IE being messed up.

What do you mean by fixed js in Drupal for IE? Please explain.

Moreover, I'm using jQuery since it's initial betas, that was around 2005/06.
 
ultra vires said:
Google Search : " jquery fix drupal"

Get your results ...

Oh my, buddy, those are fixes for IE6's bug, not a bug in jQuery or Drupal. And the search doesn't give more than 2 references to that thing; everything else is general stuff.

There exist general javascript codes for those PNG fixes. In this case a jQuery plugin is used. And you find Drupal most linked because Drupal ships jQuery in it's core. Bas hun, avein time pass na kar. :P
 
PNG fix for IE is normal :\ i never mentioned that did i ??

*ultra vires looks towards the drupal signboard and moves on from the thread*
 
You like Jquery .... good for u :)

Btw : i mentioned transparency issues ( that includes PNG as well as with other CSS used background gif images and that image soothing )
 
Use this if you wanna do it via PHP

if(isset($_POST['mobile'])){

if(is_numeric($_POST['mobile'])){
echo "Thank You!";
}else{
echo "Sorry, Invalid mobile number";
}

}
 
Status
Not open for further replies.