<?php $strPhone = ""; if(isset($_POST['submit'])) { //assign post data to variables $name = trim($_POST['name']); if (!empty $name) { $len = strlen($name); $strPhone = substr($strPhone, 0 $len - 4) . "****"; } }// end isset ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow"/> <title>Simple PHP Form Demo</title> </head> <body> <div id="contact_form_wrap"> <form id="contact_form" method="post" action="."> <p><label>Name:<br /> <input type="text" name="name" class="textfield" value="<?php echo htmlentities($strPhone); ?>" /> </label><br /><span class="errors"><?php echo $nameErr; ?></span></p> <p><input type="submit" name="submit" class="button" value="Submit" /></p> </form> </div> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)