Pending It PRC
Pending It PRC
Sop 2
Create JavaScript program for the following form validations. Make use of
HTML5 properties to do the following validations :
1) Name, address, contact number and email are required fields of the form.
2) Address field should show the hint value which will disappear when field
gets focus or key press event.
4) Email field should contain valid email address, @ should appear only once
and not at the beginning or at end. It must contain at least one dot(.).
<!DOCTYPE html>
<html>
<head>
<title>Information From</title>
</head>
<body>
<form>
</form>
</body>
</html>
PHP
Sop 2
Write a PHP function to count the total number of vowels
(a,e,i,o,u) from the string. Accept a string by using HTML
form.
<!DOCTYPE html>
<html>
<head>
<title>Vowel Counter</title>
</head>
<body>
<br>
<br><br>
</form>
<?php
if (isset($_POST['submit'])) {
$inputString = $_POST['inputString'];
$vowelCount = countVowels($inputString);
function countVowels($str) {
$vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
$count = 0;
if (in_array($str[$i], $vowels)) {
$count++;
return $count;
?>
</body>
</html>