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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:56:10+00:00 2026-05-30T04:56:10+00:00

This is a simple form for submitting a listing into a database of real

  • 0

This is a simple form for submitting a listing into a database of real estate listings. It’s my first time ever doing this, so if you notice anything I’m doing that is bad practice or just stupid in any way, please let me know.

Anyway, on to the error I’m getting:

Parse error: syntax error, unexpected T_IF, expecting ',' or ';' in C:\Program Files\EasyPHP-5.3.9\www\addform.php on line 62

I don’t see any lines that are missing semicolons, and line 62 is an if statement…. What’s this error about?

<?php
//set database login variables
require_once 'login.php'; 

//connect to server
$db_server = mysql_connect($db_hostname, $db_username, $db_password); 

//all server access lines have to be dealt with better than this. See page 227. Probably create a function. 

//Note to self: look into try/catch in php

if (!$db_server) die("Unable to connect to database: " . msql_error()); 

mysql_select_db($db_database, $db_server) or die('Unable to select database: ' . mysql_error());
$submitted = false;

//Checking if values were passed
if (isset($_POST['area']) &&
    isset($_POST['type']) &&
    isset($_POST['price']) &&
    isset($_POST['bedrooms']) &&
    isset($_POST['fullbath']) &&
    isset($_POST['halfbath']) &&
    isset($_POST['sqft']))
    //if passed, set variables accordingly
    {
        $area = get_post('area');
        $type = get_post('type');
        $price = get_post('price');
        $bedrooms = get_post('bedrooms');
        $fullbath = get_post('fullbath');
        $halfbath = get_post('halfbath');
        $sqft = get_post('sqft');
        $submitted = true;
    }
//optional field
if (isset($_POST['remarks']))
    {
        $remarks = get_post('remarks');
    }
else
    {$remarks = '';}
//form HTML
echo <<<_END
    <form action="addform.php" method="post">
    Area: <select name="area" size="1">
        <option value="Hoboken">Hoboken</options>
        <option value="Jersey City">Jersey City</options>
        <option value="Weehawken">Weehawken</options>
    </select><br />
    Type: <select name="type" size="1">
        <option value="rent">Rental</options>
        <option value="sale">Sale</options>
        <option value="commercial">Commercial</option>
    </select><br />
    Price: <input type="text" name="price" /><br />
    Bedrooms: <input type="text" name="bedrooms" /><br />
    Full Bathrooms: <input type="text" name="fullbath" /><br />
    Half Bathrooms: <input type="text" name="halfbath" /><br />
    Square Feet:    <input type="text" name="sqft" /><br />
    Remarks:    <textarea name="remarks" wrap="soft" /><br />
    <input type="submit" value="Add Listing" />
    </form>
    <br />
    <br />
_END
//if data was provided, insert it into database and confirm
if ($submitted) {
    $query = "INSET INTO bix (area, type, price, bedrooms, fullbath, halfbath, sqft, remarks) VALUES('$area', '$type', '$price', $bedrooms', '$fullbath', '$halfbath', '$sqft', '$remarks')";
    if (mysql_query($query)){
        echo "listing inserted.<br /></br />";
    } else {
        echo "insert fail: $query <br /><br />";
    }
}
  • 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-30T04:56:12+00:00Added an answer on May 30, 2026 at 4:56 am

    Well, you do have an issue with your $query.

    $query = "INSET INTO bix (area, type, price, bedrooms, fullbath, halfbath, sqft, remarks) VALUES('$area', '$type', '$price', $bedrooms', '$fullbath', '$halfbath', '$sqft', '$remarks')";
    

    INSET should probably be INSERT and you want '$bedrooms' instead of $bedrooms'

    Apart from that, you are missing a semicolon after your closing _END

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

Sidebar

Related Questions

I'm doing this tutorial: http://www.phpeveryday.com/articles/Zend-Framework-Database-Creating-Input-Form-P494.html We are building a simple input form using POST
I am currently submitting a simple PHP form via JavaScript using document.add_driver.submit(); This method
I have very simple script for submitting the form. This is html template: <table>
I am using a simple form and submitting my textbox values to database, <body>
Imagine this simple form <form action=<?php echo $_SERVER['REQUEST_URI']; ?> method=post> <fieldset> <legend>Contact Me</legend> <label
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
I have a simple form like this: <form name=serachForm method=post action=/home/search> <input type=text name=searchText
I really need help on this one. I am having a simple login form
this is a simple question. I have a form that is being validated using
I have an ajax form in asp.net mvc which is as simple as this:

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.