Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PHP Storm.. Need help with the PHP file string_work_process.php which\'s output

ID: 3888201 • Letter: P

Question

PHP Storm..

Need help with the PHP file string_work_process.php which's output valid HTML. By using regular expressions to display the result:

It has Alpha, Alpha Numeric, Name, E-Mail and Phone Number.

HTML submit to the file string_work_process.php that create input text fields labled
Alpha -"only allow alpha characters, remove all other"
Alpha- "Numeric "only allow alpha numeric characters, remove all other"
Name  - "only allow alpha numeric characters and the symbols . and ,"
E-Mail - validate that the e-mail address is correct

Phone Number - allow only numbers and the . symbol.

Explanation / Answer

//This segment displays the validation rule for all field.

if(firstname.value.length == 0){

document.getElementById('head').innerText = "* All fields are mandatory *";

firstname.focus(); return false;

}

//This segment displays the validation rule for all field.

if(firstname.value.length == 0){

document.getElementById('head').innerText = "* All fields are mandatory *";

firstname.focus();

return false;

}

//This segment displays the validation rule for zip code field.

function textNumeric(inputtext, alertMsg)

{ var numericExpression = /^[0-9]+$/;

if(inputtext.value.match(numericExpression)){ return true;

}else

{ document.getElementById('p6').innerText = alertMsg;

inputtext.focus();

return false;

}

}

//This segment displays the validation rule for address field.

function textAlphanumeric(inputtext, alertMsg){ var alphaExp = /^[0-9a-zA-Z]+$/;

if(inputtext.value.match(alphaExp)){ return true;

}else

{

document.getElementById('p5').innerText = alertMsg;

inputtext.focus();

return false;

}

}