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

  • Home
  • SEARCH
  • 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 8942113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:26:59+00:00 2026-06-15T11:26:59+00:00

I’ve constructed this code from a hodge-podge of various sources and a couple weeks

  • 0

I’ve constructed this code from a hodge-podge of various sources and a couple weeks of what I would call ‘whole immersion learning’. In other words I don’t know squat about php and just thought I could fake it but apparently I can’t.

Anywho, I know what I’ve done below will send several who see it into paroxysm of utter horror at what I’ve done to your beloved php but it can’t be helped with only 2 weeks of self education and at least it only throws up three notices now rather than all the warnings, screaming warnings and fatal errors that it did in the past.

the last errors I’m getting are…

( ! ) Notice: Undefined variable: error_name in E:\wamp\www\complete-x013_php2\iframe1\contact.php on line 65

( ! ) Notice: Undefined variable: error_email in E:\wamp\www\complete-x013_php2\iframe1\contact.php on line 77

( ! ) Notice: Undefined variable: error_code in E:\wamp\www\complete-x013_php2\iframe1\contact.php on line 89

<?php session_start(); ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>

<meta http-equiv="Content-type" content="text/html; charset=utf-8">

<title></title>

<link rel="stylesheet" type="text/css" href="style.css" />

</head>

<body>

<span style="color: #000000; font-size: 85%; font-family: Verdana, Geneva, sans-serif;">

<?php

    if (isset($_POST['submit'])) {
    $error = "
    error_name,
    error_email,
    error_code
    ";

$name =     check_input($_POST['name']);
$email =    check_input($_POST['email']);
$how =      check_input($_POST['how']);
$ifother =  check_input($_POST['ifother']);
$code =     check_input($_POST['code']);
$submit =   check_input($_POST['submit']);

$_POST['name'] = trim($_POST['name']);
$_POST['name'] = stripslashes($_POST['name']);
$_POST['name'] = htmlspecialchars($_POST['name']);

$_POST['email'] = trim($_POST['email']);
$_POST['email'] = stripslashes($_POST['email']);
$_POST['email'] = htmlspecialchars($_POST['email']);

$_POST['how'] = trim($_POST['how']);
$_POST['how'] = stripslashes($_POST['how']);
$_POST['how'] = htmlspecialchars($_POST['how']);

$_POST['ifother'] = trim($_POST['ifother']);
$_POST['ifother'] = stripslashes($_POST['ifother']);
$_POST['ifother'] = htmlspecialchars($_POST['ifother']);

$_POST['code'] = trim($_POST['code']);
$_POST['code'] = stripslashes($_POST['code']);
$_POST['code'] = htmlspecialchars($_POST['code']);

$_POST['submit'] = trim($_POST['submit']);
$_POST['submit'] = stripslashes($_POST['submit']);
$_POST['submit'] = htmlspecialchars($_POST['submit']);

    if (!empty($_POST['name'])) {
    $name = check_input($_POST['name']);
    } else {
        $error .= "error_name";
        $error_name .= "Name is required.";
    }

    if (!empty($_POST['email'])) {
    $email = check_input($_POST['email']);

        if (!preg_match("/^[a-z0-9]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email)){ 
        $error .= "error_email";
        $error_email .= "E-mail address not valid.";
        }
    } else {
    $error .= "error_email";
    $error_email .= "E-mail address is required.";
    }

    if (!empty($_POST['code'])) {
    $code = check_input($_POST['code']);

        if (strtolower($_POST['code']) != 'black'){ 
        $error .= "error_code";
        $error_code .= "Code is BLACK.";
        }
    } else {
    $error .= "error_code";
    $error_code .= "Enter Code.";
    }

    if (empty($error)) {
    $from = 'From: ' . $name . ' <' . $email . '>';
    $to = "yourmail@host.com";
    $subject = "New Subscription Contact";
    $content = "

Newsletter Subsciption submitted by $name,

E-mail: $email


They were referred to us by: $how, $ifother

-END NOTIFICATION-

";
    $success = 
    mail($to,$subject,$content,$from);
    header('Location: thanks.php');
    exit;
    }

    }

function check_input($data, $problem='')
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
        if ($problem && strlen($data) == 0)
{
    show_error($problem);
}
    return $data;
}
?>

<div>

<form action="contact.php" method="post">

<center>

<table style="border: 0px solid black; border-collapse: collapse;">

<tr>
<td style="border: 0px solid black; height: 16px;" colspan="2">[<span style="color: #ff0000;">*</span>] Denotes a required field.</td>
</tr>

<tr>
<td style="border: 0px solid black; text-align: left; text-indent: 92px; height: 12px;" colspan="2" id="error">
<?php if (!empty($error_name)) { echo '<div  class="error">' . $error_name . '</div >'; } ?>
</td>
</tr>

<tr>
<td style="border: 0px solid black; vertical-align: top; text-align: left;">
<div style="margin-top: 2px;"><span style="color: #ff0000;">*</span><label>Name:</label></div></td>
<td style="border: 0px solid black;">
<input type="text" placeholder="John or Jane Doe" style="width: 269px;" name="name" value="<?php if ($_POST['name']) { echo $_POST['name']; } ?>" /></td>
</tr>

<tr>
<td style="border: 0px solid black; text-align: left; text-indent: 92px; height: 12px;" colspan="2" id="error">
<?php if (!empty($error_email)) { echo '<div  class="error">' . $error_email . '</div >'; } ?>
</td>
</tr>

<tr>
<td style="border: 0px solid black; vertical-align: top; text-align: left;">
<div style="margin-top: 2px;"><span style="color: #ff0000;">*</span><label>E-mail:</label></div></td>
<td style="border: 0px solid black;">
<input type="text" placeholder="yourmail@host.com" style="width: 269px;" name="email" value="<?php if ($_POST['email']) { echo $_POST['email']; } ?>" /></td>
</tr>

<tr>
<td style="border: 0px solid black; height: 12px;" colspan="2"></td>
</tr>

<tr>
<td style="border: 0px solid black; height: 12px;" colspan="2">

<div style="border: 0px solid black; float: left; margin-top: 1px;">How did you find us?</div>

<div style="border: 0px solid black; float: right;">        <select width="180" height="20" style="width: 180px;" name="how">
                            <option value=""> -- Please Select -- </option>
                            <option>Google</option>
                            <option>Yahoo</option>
                            <option>Link from a website</option>
                            <option>Word of mouth</option>
                            <option>Other</option>
                            </select></div>

</td>
</tr>

<tr>
<td style="border: 0px solid black; height: 12px;" colspan="2"></td>
</tr>

<tr>
<td style="border: 0px solid black; vertical-align: top; text-align: left; width: 80px;">
<div style="margin-top: 1px;"><label>If <i>Other</i>:</label></div></td>
<td style="border: 0px solid black;">
<textarea name="ifother" placeholder="If you chose 'link' or 'other'." style="width: 269px; height: 35px;"><?php if ($_POST['ifother']) { echo $_POST['ifother']; } ?></textarea></td>
</tr>

<tr>
<td style="border: 0px solid black; text-align: left; text-indent: 265px; height: 12px;" colspan="2" id="error">
<?php if (!empty($error_code)) { echo '<div class="error">' . $error_code . '</div>'; } ?>
</td>
</tr>

<tr>
<td style="border: 0px solid black;" colspan="2" >
  <div style="border: 0px solid black; float: left; height: 18px; margin-top: 2px;">
   <span style="color: #ff0000;">*</span>What color is this '<b>black</b>' text?    </div>
   <div style="border: 0px solid black; float: right;"><input type="text" placeholder="code" style="width: 90px;" name="code" value="<?php if ($_POST['code']) { echo $_POST['code']; } ?>" /></div>
   </td>
</tr>

<tr>
   <td style="border: 0px solid black;" colspan="2"><div style="border: 0px solid black; height: 10px;"></div>
   </td>
</tr>
<tr>
   <td style="border: 0px solid black; text-align: right;" colspan="2"><input type="submit" style="width: 95px;" name="submit" value="Subscribe!" />
       </td>
</tr>
</table>
</center>
 </form>
    </div>
    </span>
    </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-06-15T11:27:00+00:00Added an answer on June 15, 2026 at 11:27 am

    You need to add this :

    $error_code = $error_email = $error_name = "";
    

    just after :

    $error = "
        error_name,
        error_email,
        error_code
        ";
    

    Like this :

    $error = "
        error_name,
        error_email,
        error_code
        ";
    $error_code = $error_email = $error_name = "";
    

    The notice is triggered because you are using .= on a undefined var.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.