Still not working ;/.
PS. textboxes are irrelevant atm as i will later get data from it to store in xml. but for now im trying just to create xml file when button is clicked.

private void button1_Click(object sender, EventArgs e)
        {
            //initialize text box
            string textboxnumber1;
            string textboxnumber2;
            string textboxnumber3;
            string assesmentbox1;
            string assesmentbox2;
            string assesmentbox3;
            string assesmentbox4;

            //get values from text box
            textboxnumber1 = textBox1.Text;
            textboxnumber2 = textBox2.Text;
            textboxnumber3 = textBox3.Text;

            CourseName[] courseNames = new CourseName[3];
            courseNames[0] = new CourseName("blablabla");
            courseNames[1] = new CourseName("ugabuga");
            courseNames[2] = new CourseName("blauga");

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.IndentChars = ("    ");
            using (XmlWriter writer = XmlWriter.Create("myCourses1234.xml", settings))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("myCourse");
                foreach (CourseName coursename in courseNames)
                {
                    writer.WriteStartElement("myCourse");
                    writer.WriteElementString("courseName", coursename.Name);
                    writer.WriteEndElement();
                    writer.Flush();

                }
                writer.WriteEndElement();
                writer.WriteEndDocument();

            }
        }

OK cheers guys, i have changed it now

            CourseName[] courseNames = new CourseName[3];
            courseNames[0] = new CourseName("blablabla");
            courseNames[1] = new CourseName("ugabuga");
            courseNames[2] = new CourseName("blauga");

but when i press button nothing happens ( at least i dont get error ) but XML file is not created and saved...

Hello guys im having a problem and i dont see where i made error. Im tryting to write something into XML file. Also how do you read textbox input and save it into XML ??

Cheers for help :)

public class CourseName
        {
            string _name;
            public CourseName(string name)
            {
                this._name = name;
            }            
            public string Name { get { return _name; } }            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            CourseName[] courseNames = new CourseName[4];
            courseNames[0] = new CourseName("blablabla");
            using (XmlWriter writer = XmlWriter.Create("myCourses1234.xml"))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("myCourse");
                foreach (CourseName coursename in courseNames)
                {
                    writer.WriteStartElement("myCourse");
                    writer.WriteElementString("courseName", coursename.Name); //<---- Object reference not set to an instance of an object
                    writer.WriteEndElement();

                }
                writer.WriteEndElement();
                writer.WriteEndDocument();

            }
        }

Ok thx for help :)

hello guys im having a little problem here.
I have few text boxes and few labels. User enters values into textboxex. Values in lables are from XML file, so the program reads for egz <price>30</price> and this price is set as a label label1 => 30 And now im wondering how to multiply a value entered by user by the value of a label ( in this case 30, but can be any number)

thank you :)

        int answer1 = 0;            
        answer1 = (textboxnumber1/100)*label1 + textboxnumber2 + textboxnumber3 + textboxnumber4;
        total1.Text = answer1.ToString();

        "Error  1   Operator '*' cannot be applied to operands of type 'int' and 'System.Windows.Forms.Label'   c:\users\boss\documents\visual studio 2010\Projects\tabs\tabs\Form1.cs  103 23  tabs

"

edit: My frist post was actually an answer lol...

original post meant to be

int answer1 = 0;
total1.Text = answer1.ToString();
answer1 = textboxnumber1 + textboxnumber2 + textboxnumber3 + textboxnumber4;

and answer is

int answer1 = 0;
answer1 = textboxnumber1 + textboxnumber2 + textboxnumber3 + textboxnumber4;
total1.Text = answer1.ToString();
.
which is original post....

So two last lines needed to be changed around. now it stores and it seem to work :)
Solved.

Hello guys im having problem displaying a math equation result in the textbox. It shows 0 and i dont really know where i got the error.
Name of the textbox where result shall be displayed is total1
Thx for help :)

        int textboxnumber1;
        int textboxnumber2;
        int textboxnumber3;
        int textboxnumber4;

        textboxnumber1 = int.Parse(textBox7.Text);
        textboxnumber2 = int.Parse(textBox10.Text);
        textboxnumber3 = int.Parse(textBox18.Text);
        textboxnumber4 = int.Parse(textBox34.Text);

        int answer1 = 0;
        answer1 = textboxnumber1 + textboxnumber2 + textboxnumber3 + textboxnumber4;
        total1.Text = answer1.ToString();

Do you need to ad a .value to the end of it?

?? add value where? i dont get sorry.

Anyway i have solved this, i scrapped the whole program and took different approach to it. ;) its now solved ;)

Hello there guys, im having little problem and help would be appreciated :)
I have few tags

<name>
<capacity>
<lectureslot>
<tutorialslot>

and so on, and i want to read each tag separatly into separate field(label), or listbox.

Here is part of my XML
<?xml version="1.0" encoding="utf-8"?>

<timetable>
    <module code="3SFE504">
        <name>Algorithms and Data Structures</name>
        <capacity cap="5">5</capacity>
        <semester sem="1">1</semester>
        <prerequisite preq="none">none</prerequisite>
        <lectureslot ls="0">Mon 9.00-11.00</lectureslot>
        <tutorialslot ts="1">Mon 11.00-13.00</tutorialslot>
    </module>

And my source code is

private void show_Click(object sender, EventArgs e)

           {
                //Clear all of the items out of the list box
                modulelist.Items.Clear();
                //String workingDir = Directory.GetCurrentDirectory();
                //XmlTextReader textReader = new XmlTextReader(workingDir + @"\xmlmodulelist.xml");

                //the path to the xml file
                string path = "xmlmodulelist.xml";
                XmlDocument CXML = new XmlDocument();
                CXML.Load(@"xmlmodulelist.xml");

                //Open the filestream
                FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

                //load the xml into the XmlDocument    
                CXML.Load(fs);                
                for (int i = 0; i < CXML.DocumentElement.ChildNodes.Count; i++)
                  {
                    //Add the innertext of the xml document to the listbox
                    //modulelist.Items.AddRange(new object[] { CXML.DocumentElement.ChildNodes[i].InnerText });
                    //XmlNode name = CXML.GetElementsByTagName("name")[0];
                   modulelist.Items.AddRange(new object[] { CXML.DocumentElement.GetElementsByTagName("name")[0]});                
                   //  modulelist.Items.AddRange(XmlNodeType.Text);  

                  }

                //Close the filestream
                fs.Close(); 

    }

And when show_click button is pressed it loads into listbox this

System.Xml.Xml.Element instead of Name Why is that ??

anyone ??

Hello there
Quick insight of what im trying to achieve here is.
User adds data to a database called property in (addproperty.php)
Then user can search for specific data in that property database
Here is the code
addproperty.php
[CODE]<?php
$dbhandle = sqlite_popen("property", 0666, $err_msg);
if(!$dbhandle) die("Could not open the database");

$query = "CREATE TABLE property(postcode VARCHAR(255),price VARCHAR(255),imagefile VARCHAR(255),visits VARCHAR(255))";
if(!sqlite_query($dbhandle, $query)){ echo "table not created (maybe already created)"; }

$postcode = $_POST['postcode'];
$price = $_POST['price'];
$imagefile = $_POST['imagefile'];
$visits = $_POST['visits'];
$query = "INSERT INTO property VALUES ('$postcode', '$price', '$imagefile', '$visits')";

if(!sqlite_query($dbhandle, $query)) { echo "Could not insert table row"; }

$query = sqlite_query($dbhandle, 'SELECT * FROM property'); //result set goes into query
$result = sqlite_fetch_all($query, SQLITE_ASSOC); //calls columns by name (or NUM for col num eg 0,1..)

// each result array element contains a row of table. The row holds pairs of row name, row value
//print_r( $result); // useful debug - show all results

foreach ($result as $arow) {
echo '<br> <b>postcode:</b> ' . $arow['postcode'] . ' <b>price:</b> ' . $arow['price'] . ' <b>imagefile:</b> ' . $arow['imagefile'] . ' <b>visits:</b> ' . $arow['visits'];
}
sqlite_close($dbhandle);
?>

<form action='' method=post>
Postcode <input type='text' name='postcode' /> <br>
Price <input type='text' name='price' /> <br>
Imagefile <input type='text' name='imagefile' /> <br>
Visits <input type='text' name='visits' /> <br>
<input type='submit' value='Submit' />
</form>

[/CODE]

And here is the code in search.php
[CODE]<html>
<body>
<form action="" method="post">
Postcode: <input type="text" name="postcode" />
<input type="submit" />
</form>
<?php
$dbhandle = sqlite_popen("property", 0666, $err_msg);
if(!$dbhandle) die("Could ...

I have noticed that checkuser does not work why ??. It does not say weather wrong details are entered or correct its just passive and does not do anything.

[CODE]<?php //this script can be run once to re-initialise the database - to drop the existing table and recreate the table

$dbhandle = sqlite_popen("propertytable", 1234, $err_msg);
if(!$dbhandle) die("Could not open the database");

 $query = "DROP TABLE activity";

if(!sqlite_query($dbhandle, $query)){ echo "table 'activity' not deleted (may be not yet exists)"; }

$query = "CREATE TABLE activity( id INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY , postcode VARCHAR(25), price VARCHAR(25), imagefile VARCHAR(25), visits(VARCHAR(25))";
if(!sqlite_query($dbhandle, $query)){ echo "table 'activity' created"; }

?> Table created
[/CODE]
This code is addpropertytable.php
When i run this code it displays nicely, but when i try to add something to table ( create table) it says "Could not insert table row" why ??
And also how to modify this code to save the data to table and xml(or a txt file) ??

Hello there i would like someone to have a peek at this code and does it solve the question correctly ?? Are there any mistakes or any improvements i could add ??
Also i struggle in this questions as i do not get it fully(in fact i dont get what sessions ment to do here), any help appreciated :)

Question:
Add user authentication. Modify checkuser.php so that a user can log in, and modify search.php so it will only run for an authenticated user logged in with checkuser.php.(Use sessions)
Add JavaScript user input form validation to the log-in form.

checkuser.php
[CODE]<script type="text/javascript">
function validateForm()
{
var x=document.forms["login"]["username"]["password"].value;
if (x==null || x=="")
{
alert("Wrong login details");
return false;
}
}
</script>
<form name="login" action='' method=post>
Username <input type='text' name='username' /> <br>
Password <input type='text' name='password' /> <br>
<input type='submit' value='Submit' />
</form>
<?php
// matchnames.php to see how many times a friends and phoneNo name matches in table
// only sees a match if matches once only (not 2 times)
//if (!(isset($_POST['username']))) { exit; } // password not sent in ... so exit

$username = $_POST['username'];
$password = $_POST['password'];

$dbhandle = sqlite_popen("passwords", 0666, $err_msg);
if(!$dbhandle) die("Could not open the database");

                           // Count rows with this   

$sql = "SELECT COUNT(password) from username WHERE name = '$username' AND password = '$password' ";
$query = sqlite_query($dbhandle, $sql); // result set goes into query
$result = sqlite_fetch_all($query, SQLITE_NUM); //calls columns by num (use ASSOC for col names)
print_r( $result); // useful debug - show all ...

Hello there i would like someone to have a peek at this code and does it solve the question correctly ?? Are there any mistakes or any improvements i could add ??

Question 3.
Write a script to search for the properties which match a postcode (call it search.php ). Use SQL search. You will need an HTML form which allows the user to type a postcode they are searching for.

search.php
[CODE]<html>
<body>
<form action="properties.php" method="post">
Postcode: <input type="text" name="postcode" />
<input type="submit" />
</form>
<?php
$con = mysql_connect("localhost","maciej","kupadupa1"); // sql database server/ username/ password
if (!$con) // if unable to access database
{
die('Could not connect: ' . mysql_error()); //throw this error
}

mysql_select_db("properties", $con); // select my database "properties"
// select from properties row postcode where postcode = user type data
$result = mysql_query("SELECT * FROM properties
WHERE postcode='$_POST['postcode'];'");

while($row = mysql_fetch_array($result)) // when found display data
{
echo $row['postcode']; // display all matching post codes
echo "<br />";
}
?>
</body>
</html> [/CODE]

Hello there i would like someone to have a peek at this code and does it solve the question correctly ?? Are there any mistakes or any improvements i could add ??
Also If any one could tell me how to save the data entered by person into one file(XML)so it can be retrieved any time later would appreciate it ;)
Thank you

Question 2:
Write a script to allow a user to add property data into a property table ( call it addproperty.php ). The table should initially have 4 columns for the property data (postcode, price, imagefile, visits). At the end of the script display the whole table contents.

addproperty.php
[CODE]Edit Properties <BR><BR>

<?php

$dbhandle = sqlite_popen("propertytable", 1234, $err_msg);
if(!$dbhandle) die("Could not open the database - run CretaActivityTable.php first");
//$field is a variable name, field is the table column name and also the form field name
if ($_POST['use']=="add") { //ADD NEW ITEM
$Postcode = $_POST['postcode'];
$Price = $_POST['price'];
$Imagefile = $_POST['imagefile'];
$Visits = $_POST['visits'];
$query = "INSERT INTO activity (postcode, price, imagefile, visits) VALUES('$Postcode', '$Price', '$Imagefile', '$Visits')";
if(!sqlite_query($dbhandle, $query)) { echo "Could not insert table row"; }
} // ADD=TRUE

$Xid = $_POST['Xid']; //the table row ID needed to change/update or delete that row

if ($_POST['use']=="change") { //CHANGE EXISTING ITEM
$Postcode = $_POST['postcode'];
$Price = $_POST['price'];
$Imagefile = $_POST['imagefile'];
$Visits = $_POST['visits'];
$query = "UPDATE activity SET postcode='$Postcode', price='$Price', imagefile='$Imagefile', visits='$Visits' WHERE id='$Xid'";
// print " sql is $query endsql";
if(!sqlite_query($dbhandle, $query)) { echo "Could not update table ...

Hello there i would like someone to have a peek at this code and does it solve the question correctly ?? Are there any mistakes or any improvements i could add ??
Thank you

Question:

  1. (a)modify the addnames.php script to read in and store two fields of data – username and password (call your script adduser.php and call the table ‘passwords’).
    (b)modify matchname.php to identify when a username and password exists in the database table (call your script checkuser.php ).

Answer:
adduser.php
[CODE]<?php
// adduser.php adds form values to database table (but adds blank row first time!)
$dbhandle = sqlite_popen("passwords", 0666, $err_msg);
if(!$dbhandle) die("Could not open the database");

$query = "CREATE TABLE passwords(username VARCHAR(255), password VARCHAR(6))";
if(!sqlite_query($dbhandle, $query)){ echo "table not created (maybe already created)"; }

//$query = "INSERT INTO passwords VALUES('John', '2534')";
$username = $_POST['username'];
$password = $_POST['password'];
$query = "INSERT INTO passwords VALUES('$username', '$password')";
//print " sql is $query ";
if(!sqlite_query($dbhandle, $query)) { echo "Could not insert table row"; }
//sqlite_query($dbhandle, $query);

$query = sqlite_query($dbhandle, 'SELECT * FROM passwords'); //result set goes into query
$result = sqlite_fetch_all($query, SQLITE_ASSOC); //calls columns by name (or NUM for col num eg 0,1..)

// each result array element contains a row of table. The row holds pairs of row name, row value
print_r( $result); // useful debug - show all results

foreach ($result as $arow) {
echo '<br> username: ' . $arow['username'] . ' password: ' . $arow['password'];
}
sqlite_close($dbhandle);
?>

<form action='' method=post>
Username <input type='text' name='username' /> <br>
Password ...

Hello fellas :)
I have a task to do, there are 10 questions and i obviously need 10 answers :) I have done (attempted) some of them /not every yet/ but i wonder if there are any errors or any correction or improvements that could be made :)
Thank you in advance!

Question1:

  1. (a)modify the addnames.php script to read in and store two fields of data – username and password (call your script adduser.php and call the table ‘passwords’).
    (b)modify matchname.php to identify when a username and password exists in the database table (call your script checkuser.php ).

Answer:

adduser.php
[CODE]<?php
// adduser.php adds form values to database table (but adds blank row first time!)
$dbhandle = sqlite_popen("passwords", 0666, $err_msg);
if(!$dbhandle) die("Could not open the database");

$query = "CREATE TABLE passwords(name VARCHAR(255), password VARCHAR(6))";
if(!sqlite_query($dbhandle, $query)){ echo "table not created (maybe already created)"; }

//$query = "INSERT INTO passwords VALUES('John', '2534')";
$username = $_POST['username'];
$password = $_POST['password'];
$query = "INSERT INTO passwords VALUES('$username', '$password')";
//print " sql is $query ";
if(!sqlite_query($dbhandle, $query)) { echo "Could not insert table row"; }
//sqlite_query($dbhandle, $query);

$query = sqlite_query($dbhandle, 'SELECT * FROM passwords'); //result set goes into query
$result = sqlite_fetch_all($query, SQLITE_ASSOC); //calls columns by name (or NUM for col num eg 0,1..)

// each result array element contains a row of table. The row holds pairs of row name, row value
print_r( $result); // useful debug - show all results

foreach ($result as $arow) {
echo '<br> Name: ' . $arow['name'] . ...

Ok all solved thanks for interest and replays :)!!!

Oh ok now i see :) little annoying thing but i understand it now :) so the " . " was the problem as it was compering 300 to 300,000 so in effect nothing was displayed ! am i right ?

So now i will proceed to questions 3

Ok i have removed spaces from the properties.txt file and i have pasted in that function and still the same result. I tried to move my print statement in and out of the IF statement, and result was that inside IF statement it didn't print anything, and outside but within loop it keeps on printing whole file

Thank you Rob i must say the explenation of yours is v good ;D. However i have run into one weird problem
[CODE]<?php
// Lets find the comparison price, if specified. Otherwise assume 100.000
$comparison_price = isset($_POST['price']) ? $_POST['price'] : '100.000';

$filename = "properties.txt";
$filepointer = fopen($filename,"r"); // open to read file
$myarray = file ($filename);

for ($mycount = 0; $mycount < count($myarray); $mycount++ )
    {
        $aline = $myarray[$mycount];
        $fields = explode(',', $aline);

        // Output current property details if price is less than or equal to comparison price
        if(compare_price($comparison_price, $fields[1])
            { 
                echo implode('<br />', $fields) . '<br />';
            }
    }
fclose ($filepointer);
    function compare_price($comparsion_price, $property_price)
    {
        return ($property_price <= $comparison_price);
    }

?>[/CODE] When running this code it says that
[B]
Parse error: syntax error, unexpected '{' in /var/www/virtual/infinit0s.cba.pl/coursework1/maximum.php on line 16[/B]

which means it doesn't know what to do after the IF statement and the character " { " is not recognized ?? why is that ?

EDIT:
[CODE]if(compare_price($comparison_price, $fields[1])[B])[/B] //<- one ) was missing ;)....
{
echo implode('<br />', $fields) . '<br />';
print $aline. '<br/>'; // this line should print $aline if the IF statement is true?
}[/CODE]

But the code doesn't display the results.

but when i move the print statement outside IF but keep it within For loop like that
[CODE] for ($mycount = 0; $mycount < count($myarray); $mycount++ )
{
$aline = $myarray[$mycount];
$fields = explode(',', $aline);

        // Output current property details if price is less than or equal to comparison price
        if(compare_price($comparison_price, $fields[1]))
            { ...

[CODE]<?
$filename = "properties.txt";
$filepointer = fopen($filename,"r"); // open to read file
$myarray = file ($filename);
for ($mycount = 0; $mycount < count($myarray); $mycount++ )
{ // one input line at a time
$aline = $myarray[$mycount];
words($aline);
}
fclose ($filepointer);

function words($aline)
{

    for($mycount=0; $mycount<str_word_count($aline); $mycount++)
        {
            $field = &getvalue($aline, $mycount);               
        }
}

$price = getvalue($text,1);
function getvalue ($text, $commaToLookFor)
{
$intoarray = explode(",",$text);
return $intoarray[$commaToLookFor];
}

        if($price = isset($_POST['price']) <= $_POST['price'])
            {                                   
                print $aline. "</br>";                      
            }
        if($price = isset($_POST['price']) <= $_POST['price'])
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'])
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'])
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'])
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'])
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'])
            {
                print $aline. "</br>";
            }

?>
[/CODE]

So i took out this bit and putted it outside the loop. But it prints only last entry or last thing in array. I know that this is probably the last value stored in $aline is the last value from the loop. But when i tried to wrap this piece of code (isset ...) into loop i was getting bunch of erros...

Also i was thinking why this didnt work either
[CODE]if($price = isset($_POST['price']) <= $_POST['300,000'])
{
print $aline. "</br>";
}[/CODE]
As for me this piece of code looks like if the price chosen by user is less or equal to 300.000 then print this line with all property details. And ...

[CODE]function words($aline)
{
$price = $_POST['price'];
$price = getvalue(1);
for($mycount=0; $mycount<str_word_count($aline); $mycount++)
{
$field = &getvalue($aline, $mycount);

        if($price = isset($_POST['price']) <= $_POST['price'] : '100.000' )
            {                                   
                print $aline. "</br>";  
            }
        if($price = isset($_POST['price']) <= $_POST['price'] : '150.000' )
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'] : '200.000' )
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'] : '250.000' )
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'] : '300.000' )
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'] : '500.000' )
            {
                print $aline. "</br>";
            }
        if($price = isset($_POST['price']) <= $_POST['price'] : '750.000' )
            {
                print $aline. "</br>";
            }
        }
}[/CODE]

when i run it i get this error
"Parse error: syntax error, unexpected ':' in /var/www/virtual/infinit0s.cba.pl/coursework1/maximum.php on line 20"
it doesnt recognize ":" character ??
sorry im lost :(

[CODE]$price = isset($_POST['price']) ? $_POST['price'] : '100.000';[/CODE]
so this line is basicly
[CODE]if($price < 100.000)
{
}[/CODE]??

Also a properties.txt file is just plain notepad text comma delimited values... price comes after first comma
so
[CODE]$price = getvalue(1);[/CODE]
getvalue is a function defined by me as
[CODE]function getvalue ($text, $commaToLookFor)
{
$intoarray = explode(",",$text);
return $intoarray[$commaToLookFor];
} [/CODE]
So isn't that functions what is needed? i mean it separates values where the "," is and after the first coma value of (price whatever it is) comes... so i thought this value would be storred in $price

This is my maximum.php file
[CODE]<?
$filename = "properties.txt";
$filepointer = fopen($filename,"r"); // open to read file
$myarray = file ($filename);
for ($mycount = 0; $mycount < count($myarray); $mycount++ )
{ // one input line at a time
$aline = $myarray[$mycount];
words($aline);
}
fclose ($filepointer);
$price = getvalue(1);
function words($aline)
{
for($mycount=0; $mycount<str_word_count($aline); $mycount++)
{
$field = &getvalue($aline, $mycount);
//how to connect my index.html (form) so when i chose an option in form
//it corresponds to an specified if statement??
//what to put inside ifs ??
if($price < 100.000)
{
}
elseif($price <150.000)
{
}
elseif($price <200.000)
{
}
elseif($price <250.000)
{
}
elseif($price <300.000)
{
}
elseif($price <500.000)
{
}
elseif($price <750.000)
{
}
else
{
}
print $field . "<br/>";
}
}

function getvalue ($text, $commaToLookFor)
{
$intoarray = explode(",",$text);
return $intoarray[$commaToLookFor];
}
?>
[/CODE]

double post by accident

quote" You would then need to know which field (array index) on a line contains the property price, and compare whether it is less than the price specified. Easy enough? "

How do i know that ? I mean i know that in my property.txt file price somes after 1st comma. so its like
NW13HA, 250.000, house1.jpg, 14. But how do i extract this price ?? from this array ?

[url]http://www.infinit0s.cba.pl/coursework1/index.html[/url] link to simple form with prices
code
[CODE]<html>
<body>
<h4>Estage Agency coursework 1</h4>
<form action ="maximum.php" method ="post">
<select name ="price">
<option>Less then 100.000</option>
<option>Less then 150.000</option>
<option>Less then 200.000</option>
<option>Less then 250.000</option>
<option>Less then 300.000</option>
<option>Less then 500.000</option>
<option>Less then 750.000</option>
</select>
<input type ="submit" />
</form>
</body>[/CODE]

Ok so in order to do the forms i need to do now html coding ?

[CODE]<?
$filename = "properties.txt";
$filepointer = fopen($filename,"r"); // open to read file
$myarray = file ($filename);
for ($mycount = 0; $mycount < count($myarray); $mycount++ )
{ // one input line at a time
$aline = $myarray[$mycount];
words($aline);
}
fclose ($filepointer);
function words($aline)
{
for($mycount=0; $mycount<str_word_count($aline); $mycount++)
{
$field = &getvalue($aline, $mycount);
print $field . "<br/>";
}
}
function getvalue ($text, $commaToLookFor)
{
$intoarray = explode(",",$text);
return $intoarray[$commaToLookFor];
}
?>
[/CODE]

Ok so this is the code i got, and i think it solves the question 1. Now i need to do if statement for questions 2.

Also can any one simplify the code i provided ?? or is that simple enough ?i mean if there is another way of presenting same thing but in much more efficient way i would like to see :)