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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:38:34+00:00 2026-05-31T17:38:34+00:00

I’m getting the following two errors when loading my page: Notice: Undefined variable: realtor

  • 0

I’m getting the following two errors when loading my page:

Notice: Undefined variable: realtor in C:\Program Files\EasyPHP-5.3.9\www\cglst\images\addform.php on line 255

and

Notice: Undefined variable: phone in C:\Program Files\EasyPHP-5.3.9\www\cglst\images\addform.php on line 256

I do define both those variables, though, so I don’t understand why I’m getting these errors. Here is my code:

function addListing() {//if data was provided, insert it into database and confirm
    //this will allow everything to be sanitized properly
    require_once "sanitize.php";
    $submitted = false;

    //Checking if values were passed
    if (isset($_POST['area']) &&
        isset($_POST['price']) &&
        isset($_POST['address']) &&
        isset($_POST['bedrooms']) &&
        isset($_POST['fullbath']) &&
        isset($_POST['halfbath']) &&
        isset($_POST['sqft']))
        //if passed, sanitize and set variables accordingly
        {
            $area = sanitizeOne(get_post('area'), 'plain');
            $price = sanitizeOne(get_post('price'), 'int');
            $address = sanitizeOne(get_post('address'), 'plain');
            $bedrooms = sanitizeOne(get_post('bedrooms'), 'int');
            $fullbath = sanitizeOne(get_post('fullbath'), 'int');
            $halfbath = sanitizeOne(get_post('halfbath'), 'int');
            $sqft = sanitizeOne(get_post('sqft'), 'int');
            $submitted = true;
        }

    //optional fields
    if (isset($_POST['remarks']))
        {
            $remarks = sanitizeOne(get_post('remarks'), 'plain');
        }
    else
        {$remarks = ' ';}

    if (isset($_POST['realtor']))
        {
            $remarks = sanitizeOne(get_post('realtor'), 'plain');
        }
    else
        {$realtor = "Anne-Marie Pelletier";}

    if (isset($_POST['phone']))
        {
            $remarks = sanitizeOne(get_post('phone'), 'plain');
        }
    else
        {$phone = "201.710.5500";}

    if ($submitted) {
        $query = 'PREPARE statement FROM "INSERT INTO bix(area, price, address, bedrooms, 
                fullbath, halfbath, sqft, remarks, realtor, phone) VALUES(?,?,?,?,?,?,?,?,?,?)"';
        mysql_query($query);
        $query = 'SET 
                    @area = "' . $area . '"' .
                    '@price = "' . $price . '"' .
                    '@address = "' . $address . '"' .
                    '@bedrooms = "' . $bedrooms . '"' .
                    '@fullbath = "' . $fullbath . '"' .
                    '@halfbath = "' . $halfbath . '"' .
                    '@sqft = "' . $sqft . '"' .
                    '@remarks = "' . $remarks . '"' .
                    '@realtor = "' . $realtor . '"' . //line 255
                    '@phone = "' . $phone . '"'; //line 256
        mysql_query($query);
        $query = 'EXECUTE statement USING @area,@price,@address,@bedrooms,@fullbath,@halfbath,@sqft,@remarks,@realtor,@phone';
        mysql_query($query);
        $query = 'DEALLOCATE PREPARE statement';
        mysql_query($query);
        return true;
    }
}
function get_post($var)
{
    return mysql_real_escape_string($_POST[$var]);
}

This is simply adding an entry to a database if it was submitted (the page submits a form to itsself to do this)

  • 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-31T17:38:36+00:00Added an answer on May 31, 2026 at 5:38 pm

    Your problem is here, a cut’n’paste error;

    if (isset($_POST['realtor']))
    {
        $remarks = sanitizeOne(get_post('realtor'), 'plain');
    }
    else
        {$realtor = "Anne-Marie Pelletier";}
    

    If realtor is set as a post parameter, you assign the post variable’s value to $remarks instead of to $realtor.

    $phone has the exact same problem.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm making a simple page using Google Maps API 3. My first. One marker

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.