About Me

My photo

I am Ram, a Web Designer and Developer.   More than 4  years of experience in software development. Created complex back-end management systems including content management, e-commerce, customer relations and communication interfaces. The projects based on PHP in conjunction. PHP, SQL, JavaScript, AJAX, XHTML, CSS (Responsive), I help people make beautiful websites, functional applications and seamless user experiences.

Wednesday, 16 September 2015

php while loop form validation using jquery

<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script><script>
function sendContact(id) {
if(!$("#userName_"+id).val()) {
$("#userName_"+id).focus();
alert('Enter the First Name');
valid = false;
}
return valid;
}
</script>
</head>
<body>

<?php 
$i=1;
while($i<5){
?>
<div>
<label>Name</label>
<input type="text" name="userName" id="userName_<?php echo $i; ?>" >
<input type="submit" name="submit" value="submit" onClick="sendContact(<?php echo $i; ?>);">
<?php $i++; }  ?>


No comments:

Post a Comment