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 6057807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:31:45+00:00 2026-05-23T08:31:45+00:00

I am working on a contact form. Now I am having a problem when

  • 0

I am working on a contact form. Now I am having a problem when the user is suppose to re enter the password it doesnt work. I know this is probaly something small but I havent been able to figure it out. Here is my code:

<?php
function showForm($strMessage){
echo "<h1>".$strMessage."</h1>";
echo " <p>Note: fields marked with '*' are required</p>\n";
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">\n";
echo "<table width=\"45%\" class=\"formtable\" cellpadding=\"3\" cellspacing=\"0\">\n";
echo "  <tr>\n";
echo "      <td><span id=\"rfvname\">* Name:</span></td>\n";
echo "      <td><input type=\"text\" name=\"name\"   value=\"".$_POST['name']."\" /></td>\n";
echo "  </tr>\n";
echo "    <tr>\n";
echo "      <td><span id=\"rfvemail\">* E-mail:</span></td>\n";
echo "      <td><input type=\"text\" name=\"email\" value=\"".$_POST['emial']."\" /></td>\n";
echo "  </tr>\n";
echo "      <tr>\n";
echo "      <td><span id=\"rfvusername\">* Username:</span></td>\n";
echo "      <td><input type=\"text\" name=\"username\" value=\"".$_POST['username']."\" /></td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "        <td><span id=\"rfvpword\">* Password:</span></td>\n";
echo "        <td><input type=\"password\" name=\"pword\" value=\"".$_POST['pword']."\" /><br /><span style=\"font-size:9px;\"><em>(at least 4 chars) </em></span></td>\n";
echo "  </tr>\n";
echo "    <tr>\n";
echo "      <td><span id=\"rfvpword\">* Re-enter Password:</span></td>\n";
echo "      <td><input type=\"text\" name=\"pword\" value=\"".$_POST['pword']."\" /></td>\n";
echo "  </tr>\n";
echo "  <tr>\n";
echo "         <td>&nbsp;</td>\n";
echo "         <td><input type=\"submit\" value=\"Submit\" class=\"btnSubmit\" id=\"btnSubmit\" name=\"submit\" /></td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</form>\n";
  }
  ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Contact Form</title>
<style type="text/css">
body{
            background-color:#FFBD40;
            color:#000000;
            font-size:100%;
            font-family:Georgia,Verdana,"Times New Roman",sans-serif;
        }


#container{
            background:#FFF573;
            width:800px;
            margin:auto;
            padding:5px 10px 5px 10px;
            border:6px double #000000;
        }
</style>
   </head>
    <body>
    <div id="container">
     <?php
if (isset($_POST['submit'])){
    if (trim($_POST['name'])==""){
        $strMessage="Please enter your name!";
        showForm($strMessage);
    }
    elseif (strlen(trim($_POST['pword']))<=3){
        $strMessage="Your password must be at least 4 characters long!";
        showForm($strMessage);
    }
    else{
         $strMessage="Thank you, your information has been submitted. Below is the information you sent:";
         $strMessageBody.="Name: ".trim(stripslashes($_POST['name']))."<br />";
         $strMessageBody.="E-mail: ".trim(stripslashes($_POST['email']))."<br />";
         $strMessageBody.="UserName: ".trim(stripslashes($_POST['username']))."<br />";
         $strMessageBody.="Password: ".trim(stripslashes($_POST['pword']))."<br />";
        echo "<h1>".$strMessage."</h1>";
        echo $strMessageBody;
    }
       }
     else{
    $strMessage= "Please fill out the form below to send your information:";
    showForm($strMessage);
    }
       ?>
     </div>
      </body>
      </html>
  • 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-23T08:31:46+00:00Added an answer on May 23, 2026 at 8:31 am

    If you request for 2 passwords for the sake of comparison you should give them different names; otherwise the second input will overwrite the first and you only get 1 value.

    Here’s how you’d go about validating your passwords:

    if (trim($_POST['name'])==""){
        $strMessage="Please enter your name!";
        showForm($strMessage);
    }
    /* START ADD */
    elseif ($_POST['pword1'] != $_POST['pword2']) {
        $_POST['pword1'] = NULL;  // Reset the values of pword1 so it is not in the form
        $_POST['pword2'] = NULL;  // Reset the values of pword2 so it is not in the form
        $strMessage="Passwords do not match!";
        showForm($strMessage);
    }
    /* END ADD */
    elseif (strlen(trim($_POST['pword']))<=3){
        $strMessage="Your password must be at least 4 characters long!";
        showForm($strMessage);
    }
    else ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on this website which requires a jquery/ajax contact form. Everything works
I had this simple modal contact form working fine but must have broke it
Hello my smart friends i have this contact form that i am working on.
I'm working on a contact form for my church website. The church has an
Okay, i posted a question before to fix my live validation contact form. Now
So now that I got the autosuggest working... I want to get my form
I have this little script to toggle a contact form when a button is
I am working on a contact form that is not posting my multiple selection
All of a sudden my form link looks like this: <form action=/r.ashx/Models.Module_ContactUs?action=Submit&amp;controller=Contact id=contactUsForm method=post>
I have been working on this form for my php class. I can not

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.