Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 823947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:01:28+00:00 2026-05-15T03:01:28+00:00

<?php function VerifyForm(&$values, &$errors) { if (strlen($values[‘fname’]) == 0) $errors[‘fname’] = ‘Enter First Name’;

  • 0
<?php

function VerifyForm(&$values, &$errors) 
{ 

  if (strlen($values['fname']) == 0) 
    $errors['fname'] = 'Enter First Name'; 

  if (strlen($values['lname']) == 0) 
    $errors['lname'] = 'Enter Last Name'; 

  if (strlen($values['mname']) == 0) 
    $errors['mname'] = 'Enter Middle Name'; 

  if (strlen($values['address']) == 0) 
    $errors['address'] = 'Enter Address'; 

  if (strlen($values['terms']) == 0) 
    $errors['terms'] = 'Please Read Terms and Agreement and Check the box.'; 

  if (!ereg('.*@.*\..{2,4}', $values['email'])) 
    $errors['email'] = 'Email address invalid'; 

  else if (strlen($values['email']) < 0) 
    $errors['email'] = 'Enter Email Address'; 

  return (count($errors) == 0); 
}


function DisplayForm($values, $errors) 
{ 
  ?> 
  <!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" /> 
  <title>GIA Soap » Products » Customer Informations</title> 
  <link href="stylesheet/style.css" rel="stylesheet" type="text/css" /> 
  <script type="text/javascript" src="js_files/jquery.js"></script> 
  <script type="text/javascript" src="js_files/sliding_effect.js"></script> 
  <script type="text/javascript" src="js_files/slideshow.js"></script> 
  </head>
<body> 
  <div class="bg_top"> 
  <div class="bg_bottom"> 
  <div class="wrapper"> 
  <div class="header"> 
  <div class="logo"> 
  </div>  
  <div class="logo_text"> 
  <div class="logo_head_text">Gia Soap Making</div> 
  <div class="logo_sub_text">Sub text here</div> 
  </div> 
  </div> 
  <div class="h_nav"> 
  <div class="h_nav_dash"> 

  </div> 
  </div> 
  <div class="container"> 
  <div class="content_term"> 
  <div class="content_terms"> 
  <br /> 
  <h1><p>Customer Information</p></h1><br />
  <p>Please the following correctly.</p>
  <div class="customer_info">

  <?php

  if (count($errors) > 0)
    echo "<p>There were some errors in your submitted form, please correct them and try again.</p>";

  ?>
 <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>"> 

  <!-- hidden values --> 

  <input type="hidden" value="<?php echo $papaya; ?>" name="papaya" /> 
  <input type="hidden" value="<?php echo $carrot; ?>" name="carrot" /> 
  <input type="hidden" value="<?php echo $guava; ?>" name="guava" /> 

  <label for="customer_fname">First Name (<i>Required</i>)</label> 
  <input type="text" class="textbox"  id="customer_fname" name="customer_fname" value="<?= htmlentities($values['fname']) ?>" /> 
  <span class="error_msg"><?= $errors['fname'] ?></span> 

  <label for="customer_lname">Last Name (<i>Required</i>)</label> 
  <input type="text" class="textbox"  id="customer_fname" name="customer_fname" value="<?= htmlentities($values['lname']) ?>" /> 
  <span class="error_msg"><?= $errors['lname'] ?></span> 

  <label for="customer_mname">Middle Name (<i>Required</i>)</label> 
  <input type="text" class="textbox"  id="customer_fname" name="customer_fname" value="<?= htmlentities($values['mname']) ?>" /> 
  <span class="error_msg"><?= $errors['mname'] ?></span> 

  <label for="customer_add">Address (<i>Required : Complete Address Please</i>)</label> 
  <input type="text" class="textbox"  id="customer_add" name="customer_add1" value="<?= htmlentities($values['address']) ?>" /><br /> 
  <input type="text" class="textbox"  id="customer_add" name="customer_add2" /><br /> 
  <input type="text" class="textbox"  id="customer_add" name="customer_add3" /> 
  <span class="error_msg"><?= $errors['address'] ?></span> 

  <label for="customer_email">Email Address  (<i>Required</i>)</label> 
  <input type="text" class="textbox"  id="customer_email" name="customer_email" value="<?= htmlentities($values['email']) ?>" /> 
  <span class="error_msg"><?= $errors['email'] ?></span> 

  <label for="customer_phone">Phone Number </label> 
  <input type="text" class="textbox"  id="customer_phone" name="customer_phone" /> 

  <label for="customer_mobile">Mobile Number </label> 
  <input type="text" class="textbox"  id="customer_mobile" name="customer_mobile" /> 

  <br /><br /> 

  <div class="terms"> 
  <center> 
  <h1>Terms and Agreement</h1><br /> 
  <p>Please read the following.</p><br /> 
  </div> 
  <br /> 

  <input type="checkbox" name="terms" value="<?= htmlentities($values['terms']) ?>" /> I Read the Terms and Agreement<br /><br /> 
  <span class="error_msg"><?= $errors['terms'] ?></span> 
  <input type="submit" value="Send Order" class="prod_subbtn" /> 

  </center> 

  </form> 
  </div> 
  </div> 
  </div> 
  <div class="clear"></div> 
  </div> 
  <?php include ('includes/footer.php'); ?> 
  </div> 
  </div> 
  </div> 
  </body> 
  </html>
<?php

}


function ProcessForm($values) 
{
  $papaya = $_POST['papaya']; 
  $carrot = $_POST['carrot']; 
  $guava = $_POST['guava']; 
  $fname = $_POST['fname']; 
  $lname = $_POST['lname']; 
  $mname = $_POST['mname']; 
  $address = $_POST['address']; 
}

if ($_SERVER['REQUEST_METHOD'] == 'POST') 
{ 
  $formValues = $_POST; 
  $formErrors = array(); 

  if (!VerifyForm($formValues, $formErrors)) 
    DisplayForm($formValues, $formErrors); 
  else 
    ProcessForm($formValues); 
} 
else 
  DisplayForm(null, null);

?>

The output is:
Screenshot of output

Problem
The PHP code that is supposed to put in the field values can be seen by users.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:01:29+00:00Added an answer on May 15, 2026 at 3:01 am

    Chances are short_open_tags is off. Use <?php echo ...; ?> instead of <?=... ?>, like this:

    <?php echo htmlentities($values['lname']); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 400k
  • Answers 400k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Asserting whether your shuffle method actually shuffles the cards is… May 15, 2026 at 4:09 am
  • Editorial Team
    Editorial Team added an answer Such a behavior can be caused by MultiViews. Try to… May 15, 2026 at 4:09 am
  • Editorial Team
    Editorial Team added an answer First and foremost you need to figure out what is… May 15, 2026 at 4:09 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.