ruwanaru 0 Junior Poster in Training

**

I want a Help to Intergrate Google Calendar API to create Events thure webisite

**

Ihave tied some google documantation and some tutorials buth they acctually not working properly google documantions are not not working for me

ruwanaru 0 Junior Poster in Training

i need to add new tag to head section on a HTML page using PHP

actualy i need to add

<link rel="canonical" href="<?php echo 'http://'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ?>"/>

Hope this can do using PHP DOM

ruwanaru 0 Junior Poster in Training

need to alight div inside another div
inner div must be aligned centerd bottom of the outer div
i have attached a image that i want

ruwanaru 0 Junior Poster in Training

Here is the Files im using

ruwanaru 0 Junior Poster in Training

no i didn't got any errors

ruwanaru 0 Junior Poster in Training

I thing the problem with you is connecting with data base.
make sure mysql connection with data base is correct.

and use

mysql_select_db('helikro')

and use

INSERT INTO `itinerary` ()

instead of

INSERT INTO `helikro`.`itinerary` ()

Not working friend

i think their is problem with line 8
if i use

echo $deatils =$_POST["itadetails"];

instead of

echo $deatils ="Text here ";

then the codes are working fine

ruwanaru 0 Junior Poster in Training


This codes are not working here and i cant find out why is that can you help me on this

(here i gave the database also problem is not in DB)

CREATE TABLE `itinerary` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(1000) NOT NULL,
  `name` varchar(1000) NOT NULL,
  `days` varchar(10) NOT NULL,
  `introduction` longtext NOT NULL,
  `holiday_highlights` mediumtext NOT NULL,
  `deatils` longtext NOT NULL,
  `pic1` varchar(1000) NOT NULL,
  `pic2` varchar(1000) NOT NULL,
  `pic3` varchar(1000) NOT NULL,
  `pic4` varchar(1000) NOT NULL,
  `pic5` varchar(1000) NOT NULL,
  `pic6` varchar(1000) NOT NULL,
  `map` varchar(1000) NOT NULL,
  `pre_accom` varchar(1000) NOT NULL,
  PRIMARY KEY (`id`)
)
<?php
include ("../../init/db.php");
$type =$_POST['type'];
$name =$_POST['name'];
$days = $_POST['days'];
$introduction = $_POST['introduction'];
$holiday_highlights = $_POST['holidayh'];
echo $deatils1 =$_POST["itadetails"]; 
echo strlen($deatils);
$pre_accom = $_POST['pre_accom'];





mkdir('../../itinerary/'.$name, 0777); 

$destination_path = '../../itinerary/'.$name.'/';

 	
    	$lmap= $name.basename( $_FILES['map']['name']);
		$img1= $name.basename( $_FILES['img1']['name']);
		$img2= $name.basename( $_FILES['img2']['name']);
		$img3= $name.basename( $_FILES['img3']['name']);
		$img4= $name.basename( $_FILES['img4']['name']);
		$img5= $name.basename( $_FILES['img5']['name']);
	    $img6= $name.basename( $_FILES['img6']['name']);
	
	
	
		
   
		$target_path_lmap = $destination_path . $lmap;		
		$target_path_img1 = $destination_path .$img1;
		$target_path_img2 = $destination_path .$img2;
		$target_path_img3 = $destination_path .$img3;
		$target_path_img4 = $destination_path .$img4;
		$target_path_img5 = $destination_path .$img5;
		$target_path_img6 = $destination_path .$img6;
	
	
	
		
		
	
	
   if(@move_uploaded_file($_FILES['banner']['tmp_name'], $target_path_banner) 
		&&										
	  @move_uploaded_file($_FILES['lmap']['tmp_name'], $target_path_lmap)&&
	  @move_uploaded_file($_FILES['img1']['tmp_name'], $target_path_img1)&&
	  @move_uploaded_file($_FILES['img2']['tmp_name'], $target_path_img2)&&
	  @move_uploaded_file($_FILES['img3']['tmp_name'], $target_path_img3)&&
	  @move_uploaded_file($_FILES['img4']['tmp_name'],$target_path_img4)&&
	  @move_uploaded_file($_FILES['img5']['tmp_name'], $target_path_img5)&&
	  @move_uploaded_file($_FILES['img6']['tmp_name'], $target_path_img6)
	  		  
	  ) 
   {  

		$resultw = $name." Uploading Success";
	  
  	 }else{
		 
		 $resultw = "not success";
		 }
		 
		 
		
		 
		  


   
		$path_lmap = 'hotels/'.$name.'/' . $lmap;
		
		$path_img1 = 'hotels/'.$name .'/'.$img1;
		$path_img2 = 'hotels/'.$name.'/'.$img2;
		$path_img3 = 'hotels/'.$name .'/'.$img3;
		$path_img4 = 'hotels/'.$name .'/'.$img4;
		$path_img5 = 'hotels/'.$name .'/'.$img5;
		$path_img6 = 'hotels/'.$name.'/'.$img6;
$sql="
INSERT INTO `helikro`.`itinerary` (
`id` ,
`type` ,
`name` , …
ruwanaru 0 Junior Poster in Training

I just ran this code. The answer was not rounded. (.751)

<?php

$qty = 0.1;
$rate = 7.51;

$total = $rate * $qty;

echo $total;

?>

yes this is working but i want to get values from text box

ruwanaru 0 Junior Poster in Training
<?php

$qty = $_post['qty'];
$rate = $_post['rate'];

$total = $rate * $qty;

echo $total;

?>

i want to print the float number in total but it gives rounded Number

ruwanaru 0 Junior Poster in Training

I want to Create a row as the same as above

<HTML>
<HEAD>
    <TITLE> TESTING</TITLE>

</HEAD>
<BODY>

    <INPUT type="button" value="Add Row"/>

  

    <TABLE id="dataTable" width="350px" border="1">
        <tr bgcolor="#0099FF">
    <th width="88" bgcolor="#66CCFF" scope="col">Code</th>
    <th width="289" bgcolor="#66CCFF" scope="col">Product</th>
    <th width="35" bgcolor="#66CCFF" scope="col">Qty</th>
    <th width="144" bgcolor="#66CCFF" scope="col">Rate</th>
    <th width="146" bgcolor="#66CCFF" scope="col">Value</th>
  </tr>



<!----- Same as this Row -----!>
  <tr>
    <td>
    
    <label>
      <select id="code"  onChange="ajaxFunction()">
       
        <?php
          while($info=mysql_fetch_array($result1)){
     $id=$info['id'];
     $code=$info['code'];
echo '<option value="'.$id.'">'.$code.'</option>';
      }
        ?>
        
      </select>
    </label></td>
    <td><input name="proname" type="text" id="proname" size="50" readonly="readonly" /></td>
    <td><label>
      <input NAME="qty" type="text" id="qty" size="2" onchange="CalculateTotal1()"  />
    </label></td>
    <td><input name="rate" type="text" id="rate"  onchange="CalculateTotal2()"/></td>
    <td><input name="tot" type="text" id="tot" readonly="readonly" />



</td>

<!----- END of Row -----!>


  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><label>
      
    </label></td>
    <td>&nbsp;</td>
    <td>Total</td>
    <td><input name="textfield4" type="text" id="textfield4" readonly="readonly" /></td>
  </tr>
    </TABLE>



</BODY>
</HTML>
ruwanaru 0 Junior Poster in Training

This is the code that not getting the result

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Nice select</title>
<script Language="JavaScript">
function checkData()
    {
    
    var myTest  = me.D1.value;
     //alert(myTest);
	 
	 var req = new Request.JSON({
        url: 'dbselect.php',
        method: 'post',
        data: 'brand=' + encodeURIComponent(myTest)
    });
	 req.addEvent('success', function(response) {
				
			
			var ts = new String(response);
			document.me.inter.value = ts;

      
    });
    req.send();
	 
	 
     }
</script>

</head>

<body>
<form method="POST" name="me" id="me">
    <select size="1" name="D1"  onChange="checkData()">
    <option value="99">Default</option>    
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    </select>
    
    <input name="inter" id="inter"  type="text" >
</form>
</body>
</html>

This is the "dbselect.php" this is working well

<?php
include("../init/db.php");
$id=$_POST['brand'];
$sql="SELECT * FROM tea_type
WHERE id = '$id' ";
$data = mysql_query($sql);
while($info = mysql_fetch_array($data)){
	$model = $info['product'];

}
echo json_encode($model);
?>
ruwanaru 0 Junior Poster in Training

This is form that i want to submit and send a mail to my email i have used some codes for that and it doesn't work

<form id="F2" name="F2" method="post" action="contact/send_contact.php" onsubmit="return validateForm(this)">
         <div id="hedding"> <h2>Contact Details</h2>
               </div>
               <P><center><?php 
			   error_reporting(0);
			   include("init/db.php");
			   $table=$_GET['hotel'];
			   $id=$_GET['id'];			   
			   $sql = "SELECT * FROM $table WHERE id=$id";
			   $result=mysql_query($sql);  


  while($info=mysql_fetch_array($result)){
	 $name=$info['name'];
	  echo '<h3>'.$name.'</h3><input name="hotelname" type="hidden" id="hotelname" value=" '.$name.'" /> ';
	  }

			   
			   ?></center></P>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td><table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tbody>
                      <tr>
                        <td width="24%"> Name* :</td>
                        <td align="left" width="76%"><input name="name" id="name" size="70" type="text" /></td>
                      </tr>
                    </tbody>
                    </table></td>
                </tr>
              </tbody>
            </table>
            <table cellpadding="0" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td colspan="4" height="6"></td>
                </tr>
                <tr>
                  <td align="left" valign="middle" width="24%">Phone Number* :</td>
                  <td align="left" valign="middle" width="36%"><input name="phone" id="phone" size="15" maxlength="20" type="text" /></td>
                  <td align="left" valign="middle" width="14%">Home :</td>
                  <td align="left" valign="middle" width="26%"><input name="home" id="home" size="15" maxlength="20" type="text" /></td>
                </tr>
                <tr>
                  <td colspan="4" align="left" valign="middle" height="6"></td>
                </tr>
                <tr>
                  <td align="left" valign="middle">E-mail * :</td>
                  <td align="left" valign="middle"><input name="email" id="email" size="40" type="text" /></td>
                  <td align="left" valign="middle"></td>
                  <td align="left" valign="middle"></td>
                </tr>
                <tr>
                  <td colspan="4" align="left" valign="middle" height="6"></td>
                </tr>
                <tr>
                  <td align="left" valign="middle">Fax number :</td>
                  <td align="left" valign="middle"><input name="fax" id="txtFax2 " size="15" maxlength="20" type="text" /></td>
                  <td align="left" valign="middle"></td>
                  <td align="left" valign="middle"></td>
                </tr>
                <tr>
                  <td align="left" valign="middle" height="6">Country of Residence</td>
                  <td align="left" valign="middle"><select name="country" id="country">
                    <option value="" selected="selected">-------------Choose One-------------</option>
                    <option value="Sri Lanka ">Sri Lanka </option>
                    <option value="Afghanistan">Afghanistan </option>
                    <option value="Albania">Albania </option>
                    <option value="Algeria">Algeria </option>
                    <option value="Andorra">Andorra </option>
                    <option value="Angola">Angola </option>
                    <option value="Anguilla">Anguilla </option>
                    <option value="Antarctica">Antarctica </option>
                    <option value="Antigua &amp; Barbudo">Antigua &amp; Barbudo </option>
                   
                    <option value="Zambia …
ruwanaru 0 Junior Poster in Training

can any one help me

ruwanaru 0 Junior Poster in Training

i got this error in my code in my hosting account plz help ti solve it

"Error connecting the database"

this is my connection codes

$MYSQL_SERVER='jsnf.db.6477609.hostedresource.com'; //sessions not need for this one
$MYSQL_USER='jsnf';
$MYSQL_DB='jsnf';
$password='[removed]';
mysql_connect($MYSQL_SERVER,$MYSQL_USER,$password) die("Error connecting the database");
mysql_select_db($MYSQL_DB) die("Error Selecting the database");

this information give me by Hosting account

MySQL Database Information
Status:Setup

Host Name:jsnf.db.6477609.hostedresource.com

Database Name:jsnf

Database Version:5.0

Description:Not Set

User Name:jsnf

DSN:mysql_jsnf.dsn 
Installed
ruwanaru 0 Junior Poster in Training

any one for a help.............

ruwanaru 0 Junior Poster in Training

Flash is not connect the backend database directly. you can use JSON to pass the datas between flash and sql with php.

can you help me for that

ruwanaru 0 Junior Poster in Training

HELLO ...........

i want to do a flash movie that if i select a city it gives book dealers list from my SQL database

i have no idea to solve this

i can do the flash thing and c# and sql thins i don't know how to connect those things

are any one can help for this

ruwanaru 0 Junior Poster in Training

Helloo

Im new in Databases.
I want to create a simple shopping cart i have a table called product

CREATE TABLE  `products` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` varchar(150) NOT NULL,
  `name` varchar(100) NOT NULL,
  `author` varchar(100) NOT NULL,
  `details` varchar(10000) NOT NULL,
  `price` int(11) NOT NULL,
  `imgpath` varchar(500) NOT NULL,
  `dateadded` date NOT NULL,
  `stock` int(11) NOT NULL,
  PRIMARY KEY (`id`)
)

what i want is when i click the add to cart button the product must add to a cart i don't have a idea how to do this

ruwanaru 0 Junior Poster in Training

How is this relevant to JSP?

i think progress bar can be creat with JSP

ruwanaru 0 Junior Poster in Training

That error again, grr. I have read about it and if the file begins with a crc32 hash (I think) then php will end up just dumping an error. Although I have experienced this error myself it doesn't seem to be very common. I think the solution would be to replace the move_uploaded_file() with a custom function and also I would suggest trying the following to see if you get any other error messages too...

<?php
ini_set('upload_max_filesize','1000M');
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
move_uploaded_file($_FILES['uploaded']['tmp_name'], $target);
?>

it is nor workin sorry.....

ruwanaru 0 Junior Poster in Training

Could you please describe in detail what happens when you try to upload. Are their any error messages and if so what messages are shown.

ok this is the error

Sorry, there was a problem uploading your file.

file size is not the matter i think its file type

ruwanaru 0 Junior Poster in Training

Try the following:

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
<?php
ini_set('upload_max_filesize','1000M');
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>

thank you for the helping but it doesn't upload flv files

ruwanaru 0 Junior Poster in Training

What i want is when i click upload button upload the file with progress bar

<form action="image_upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="filei" id="filei" />
<input type="submit" name="button2" id="button2" value="Upload" />
</form>

this is my php file

<?php
 $name=$_FILES["filei"]["name"];
  $size=$_FILES["filei"]["size"];
 $type1=$_FILES["filei"]["type"];

$dirpath = "upload/";
  //upload image
  if ((($_FILES["filei"]["type"] == "image/gif")
|| ($_FILES["filei"]["type"] == "image/jpeg")
|| ($_FILES["filei"]["type"] == "image/pjpeg")|| ($_FILES["file"]["type"] == "image/JPEG")|| ($_FILES["filei"]["type"] == "image/jpg")|| ($_FILES["filei"]["type"] == "audio/mpeg")|| ($_FILES["filei"]["type"] == "audio/x-mpegurl"))
&& ($_FILES["filei"]["size"] < 20000000000000))
  {
  if ($_FILES["filei"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["filei"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["filei"]["name"] . "<br />";
    echo "Type: " . $_FILES["filei"]["type"] . "<br />";
    echo "Size: " . ($_FILES["filei"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["filei"]["tmp_name"] . "<br />";

    if (file_exists("$dirpath" . $_FILES["filei"]["name"]))
      {
      echo $_FILES["filei"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["filei"]["tmp_name"],
      "$dirpath" . $_FILES["filei"]["name"]);
      echo "Stored in: " . "$dirpath" . $_FILES["filei"]["name"];
	  $ipath = "$dirpath" . $_FILES["filei"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
  //end of image uploading
 ?>
ruwanaru 0 Junior Poster in Training

Can any one modify this code for my work

Form

<form enctype="multipart/form-data" action="uploader.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>

php file

<?php
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>
ruwanaru 0 Junior Poster in Training

There is a nice tizag tutorial I would suggest following. Basically all you need to do is set a html form which will post files to the server. Then after uploading the server can validate. That is after uploading the server validates as many people get confused with this. And when the file is uploaded, the location of the file can be recorded into a mysql database for later access. Enjoy the tutorial.

i tried this and this didn't allow to upload mp3 and flv files

ruwanaru 0 Junior Poster in Training

I need a help to upload mp3 and flv uploading codes can any one help me on this

ruwanaru 0 Junior Poster in Training

Hey.

Can you explain this a little better? Just so we know what we are looking for.

The phrase "is not working" (in any form) is a completely useless statement when you are describing your problem. We already know it's not working. That is why you posted it. What we need to know is how it is supposed to be working and how it is actually working.

Thanks :)

im sorry about that

in this codes what i want to do is when i selected a value in master (select list/menu) and get the relevant data from db and put in to slave(select list/menu) thi codes are working without jquery.js file but the thing is i want jquery file also
thank you for the reply im sorry im not good in english

ruwanaru 0 Junior Poster in Training

What is it supposed to do, and is it possible to see it somewhere in action online ?

im sorry about that what i want is when i select a value in a select (list/menu)
i want to get from relevant data to a another select (list/menu)

but i used this codes in a another place that is working if i removed that two files from my coding then this cods are working but iwant this two files also

here is the files that i used (Attached)

ruwanaru 0 Junior Poster in Training

Did you check where you copied the files. Maybe they are in a different folder then you specified.

yes i checked that their is no error in their

ruwanaru 0 Junior Poster in Training

This is my codes

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript" src="js/mootools.js"></script>
<script language="javascript" type="text/javascript" src="js/getchqno.js"></script>
</head>

<body>
<script type="text/javascript">
function buildSelect(select, options)
{
    var select = $(select);
    select.empty();
    options.each(function(item) {
        if($type(item) != "array")
        {
            item = [item, item];
            var option = new Element("option", {
                text: item[0].toString(),
                value: item[1].toString()
            });
            option.inject(select);
        }
    });
}

function domready()
{
    $('master').addEvent('change', master_changed);
}

function master_changed()

{
	
    var req = new Request.JSON({
        url: 'getowner.php',
        method: 'post',
        data: 'id=' + encodeURIComponent($('master').get('value'))
    });
    req.addEvent('success', function(response) {
        buildSelect('slave', response);
    });
    req.send();
}

window.addEvent('domready', domready);
</script>
<form action="" method="post" name="F21" id="F21">
  <p>Make
    <select name="make" id="master">
      <option selected="selected" >d1</option>
      <?php
   include("init/db.php");
       $sql="SELECT *
FROM `customers`";
		
		$result=mysql_query($sql);
		while ($info=mysql_fetch_array($result)){
			$id= $info['id'];
			$name = $info['fname']." ".$info['lname'];
			echo '<option value="'.$id.'">'.$name.'</option>';
			}		
		
		?>
    </select>
  </p>
  <p>Model
    <select name="model" id="slave">
      <option>SELECT</option>
    </select>
  </p>
</form>
</body>
</html>

if i added this two files to this files my codes are not working

<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src=".../js/jquery.min.js"></script>

can any one help me to solve this problem i am a new one in JS

ruwanaru 0 Junior Poster in Training

In this the JS Codes (in the code tag)are not working only in this page can any one help me on this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Luxmi Lanka</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="CSS/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript" src="js/js1.js"></script>
<script language="javascript" type="text/javascript" src="js/mootools.js"></script>
<script language="javascript" type="text/javascript" src="js/getchqno.js"></script>

</head>

<body onload="GetValues()">
<div id="body" >
<div id="head"><img src="images/banner.png" width="498" height="123" />
<div id="menutop">
    <ul>
        <li><a href="index.php"><span>&nbsp; Home&nbsp; </span></a></li>
        <li><a href="addsupcus.php"><span> &nbsp;Controll&nbsp; </span></a></li>

        <li><a href="report.php"><span> &nbsp;Reports&nbsp; </span></a></li>
        <li><a href="#"><span> &nbsp;Other&nbsp; </span></a></li>
    </ul>
</div>
</div>


<div id="content"><!-- InstanceBeginEditable name="EditRegion3" --><div id="sidemenu">
    <p><a href="index.php?supstatus=1&cusstatus=0">Supplier Transactions</a></p>
    <p><a href="index.php?supstatus=0&cusstatus=1">Coustomer Transactions</a></p>
    <p><a href="index.php?supstatus=0&cusstatus=1">Cheque</a></p>

</div>
<div id="divadd">

div for add informations
<div  id="cheqdes">
  <p><b>Clearence Cheques Of Today</b></p>
  <table width="185" border="0" bgcolor="#fff3ff" style="margin-left:auto; margin-right:auto;">
    <tr style="background-color: #eab8eb;" >
      <td width="95"><b>Name</b></td>
      <td width="74"><b>Ammount</b></td>
    </tr>
    <?php 
    include("init/db.php");
       $today=date("Y-m-d");
      $sql="SELECT *
FROM `cheques_details` where date='$today'";
$result=mysql_query($sql);
while($info=mysql_fetch_array($result)){
    $name=$info['name_of_owner'];
    $ammount=$info['ammount'];
    $id=$info['id'];
    $url="'chq/chqpopup.php?id=$id'";
     echo '<tr onclick="javascript:popUpchq('.$url.')" id="chqtb">
      <td>'.$name.'</td>
      <td>'.$ammount.'</td>
    </tr>';
    }

      ?>

  </table>
  <p>&nbsp;</p>
</div>

<script type="text/javascript">
function buildSelect(select, options)
{
    var select = $(select);
    select.empty();
    options.each(function(item) {
        if($type(item) != "array")
        {
            item = [item, item];
            var option = new Element("option", {
                text: item[0].toString(),
                value: item[1].toString()
            });
            option.inject(select);
        }
    });
}

function domready()
{
    $('master').addEvent('change', master_changed);
}

function master_changed()

{

    var req = new Request.JSON({
        url: 'getowner.php',
        method: 'post',
        data: 'id=' + encodeURIComponent($('master').get('value'))
    });
    req.addEvent('success', function(response) { …
ruwanaru 0 Junior Poster in Training

This should do the trick:

<script type="text/javascript">
function toggleVis(id) {
var vis1 = document.getElementById(id).style.display;
if (vis1 == "inline") {
document.getElementById(id).style.display = "none";
} else {
document.getElementById(id).style.display = "inline";
}
}
</script>

<input type="checkbox" id="div1chk" onclick="toggleVis('div1');" />
<input type="checkbox" id="div2chk" onclick="toggleVis('div2');" />
<input type="checkbox" id="div3chk" onclick="toggleVis('div3');" />

<div id="div1" style="display:none;">
div1 showed
</div>
<div id="div2" style="display:none;">
 div2  showed
</div>
<div id="div3" style="display:none;">
div3  showed
</div>

~G

thank you this is working can you help me to create a effect like

slideToggle("slow");
ruwanaru 0 Junior Poster in Training

What i need is Toggle the each div with the relevant check box

ex:- when i checked "div1chk" i want to toggle "div1"

<input type="checkbox" id="div1chk" />
<input type="checkbox" id="div2chk" />
<input type="checkbox" id="div3chk" />


<div id="div1">
div1 showed
</div>
<div id="div2">
 div2  showed
</div>
<div id="div3">
div3  showed
</div>
ruwanaru 0 Junior Poster in Training

anyone to help me

ruwanaru 0 Junior Poster in Training

I need a help with php i have a query it generate result that list of cars and i want is divide in to pages here im giving the table structure and the php file can help me on this

Table Structute

CREATE TABLE IF NOT EXISTS `cars` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `make` varchar(50) NOT NULL,
  `model` varchar(50) NOT NULL,
  `trans` varchar(50) NOT NULL,
  `fuel` varchar(50) NOT NULL,
  `year` int(11) NOT NULL,
  `km` int(11) NOT NULL,
  `vin` int(11) NOT NULL,
  `regdetails` varchar(50) NOT NULL,
  `state` varchar(50) NOT NULL,
  `price` varchar(100) NOT NULL,
  `features` varchar(1000) NOT NULL,
  `pic1` varchar(5000) NOT NULL,
  `pic2` varchar(5000) NOT NULL,
  `pic3` varchar(5000) NOT NULL,
  `pic4` varchar(5000) NOT NULL,
  `pic5` varchar(5000) NOT NULL,
  `pic6` varchar(5000) NOT NULL,
  `uname` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `uname` (`uname`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;

--
-- Dumping data for table `cars`
--

INSERT INTO `cars` (`id`, `make`, `model`, `trans`, `fuel`, `year`, `km`, `vin`, `regdetails`, `state`, `price`, `features`, `pic1`, `pic2`, `pic3`, `pic4`, `pic5`, `pic6`, `uname`) VALUES
(14, 'ALFA ROMEO ', 'ALFA', 'Automatic', 'Gasoline/Petrol', 2009, 0, 0, 'Unregisted', 'Northern Territory', 'ASK', '<li>Anti-Lock Brakes(ABS)</li><li>Driver Airbag</li><li>Passenger Airbag</li><li>Side Airbag</li><li>Alarm</li><li>A/C:front</li><li>Cruise Control</li><li>Navigation System</li><li>Power Steering</li><li>Remote Keyless Entry</li><li>Tilt Wheel</li><li>Digital Meter</li><li>Child Seat</li><li>Leather Seats</li><li>Power Seats</li><li>Bucket Seat</li><li>Power Windows</li><li>Rear Window Wiper</li><li>Tinted Glass</li><li>AM/FM Radio</li><li>AM/FM Stereo</li><li>CD Changer</li><li>CD Player</li><li>Premium Sound</li><li>Satellite Radio</li><li>DVD</li><li>TV</li><li>Alloy Wheels</li><li>Power Door Locks</li><li>Power Mirrors</li><li>Sunroof</li><li>Third Row Seats</li><li>Power Slide Door</li><li>Custom wheels</li><li>Fully loaded</li><li>Maintenance records available</li><li>New paint</li><li>New tires</li><li>No accidents</li><li>One owner</li><li>Performance tires</li><li>Upgraded sound system</li><li>Turbo</li>', './adpics/AlfaRomeoC8.jpg', './adpics/Alfa-Romeo-8c-Competizione.jpg', './adpics/alfa-romeo-8c.jpg', './adpics/alfa-8c.jpg', './adpics/alfa8c.jpg', './adpics/2003_Alfa_Romeo_8C_Competizione_Concept.jpg', 'nirman'),
(11, 'BMW ', 'M3', 'Automatic', 'Diesel', 2007, 123, 0, 'Unregisted', 'Western Australia', 'ASK', '<li>Anti-Lock …
ruwanaru 0 Junior Poster in Training

but the db conent are working in this page

ruwanaru 0 Junior Poster in Training

try this..........!!

---------------------------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php 
if(isset($_POST['input'])) {
  include("../init/db.php");
  
  $yearfom = $_POST["yearFrom"];
	$yearTo = $_POST["yearTo"];
	
	$Year ="SELECT";
	
	if($yearfom!="SELECT"){
		$Year ="";
		}
	
		$content = array("make"=>$_POST["make"],
					 "model"=>$_POST["model"],
					 "year"=>"$Year");


   
    $validValues=array();

	foreach ($content as $key=>$value)
	{
		if($value != "SELECT")
		  {
			 $validValues[$key]=$value;	
							
		  }
		  
	}
	
	$query ="select * from cars where ";
	foreach($validValues as $key=>$value)
	{

		$query1 = $query.$key."='".$value."' AND ";
		$qu1=true;
		if($key == "year"){
			$query1 = substr($query1,0,-8);
			$query2 = $query1." BETWEEN '".$yearfom."' AND ' ".$yearTo."' ";
			$qu1=false;
			$qu2=true;
			
			}
			
				
	}
	
	if($qu1==true){
	$query = substr($query1,0,-4);
	echo $sql = $query;
	
	}elseif($qu2==true){
		
		$query = $query2;
		echo $sql = $query;
		}		
  
  
// how many rows to show per page
$rowsPerPage = 2;

// by default we show first page
$pageNum = 1;

// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
    $pageNum = $_GET['page'];
}

// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
  
 
 
 
 
// $sql= "select * from cars where year BETWEEN '2007' AND ' 2009' ";
  $result=mysql_query($sql);
   $row=mysql_num_rows($result);
     
  while($info=mysql_fetch_array($result)){


    
	 $make = $info['make'];
	  $model = $info['model'];
	  $price = $info['price'];
	  $features = $info['features'];
	  $year= $info['year'];
	  
	 $pic1=$info['pic1'];
	 $pic2=$info['pic2'];
	  $pic3=$info['pic3'];
				   
		   
	  $id = $info['id'];
	  $desc=str_replace ("<li>", "   ", $features);
	  
	   $ftt = substr($desc,0,120)."................."; 
	    $abc="'viewad.php?id=$id'";


echo	'<div id="adcontent"><a  onclick="javascript<b></b>:popUp('.$abc.')"">
	<div id="cars">
  			<div style="background-color:#0091DE; padding:5px; font-weight: bold; color:#FFF;">
   		 '.$make.' - '.$model.' -  '.$year.'
     	    </div>
 			 <div style="padding:10px; font-size: 30px;">
      			<img src="'.$pic1.'" width="20%" height="20%" style="margin:5px;"/>    
   		 		<img src="'.$pic2.'" width="20%" height="20%" style="margin:5px;" />
    			<img src="'.$pic3.'" width="20%" height="20%"style="margin:5px;"/> $ '.$price.' 
             </div>  
  				<div style="padding: 15px;">    
    			<P …
ruwanaru 0 Junior Poster in Training

db.php

<?php
$MYSQL_SERVER='localhost'; //sessions not need for this one
	$MYSQL_USER='root';
	$MYSQL_DB='bcar';
	
		mysql_connect($MYSQL_SERVER,$MYSQL_USER) || die("Error connecting the database");
	mysql_select_db($MYSQL_DB) || die("Error Selecting the database");
	?>

Table

CREATE TABLE IF NOT EXISTS `cars` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `make` varchar(50) NOT NULL,
  `model` varchar(50) NOT NULL,
  `trans` varchar(50) NOT NULL,
  `fuel` varchar(50) NOT NULL,
  `year` int(11) NOT NULL,
  `km` int(11) NOT NULL,
  `vin` int(11) NOT NULL,
  `regdetails` varchar(50) NOT NULL,
  `state` varchar(50) NOT NULL,
  `price` varchar(100) NOT NULL,
  `features` varchar(1000) NOT NULL,
  `pic1` varchar(5000) NOT NULL,
  `pic2` varchar(5000) NOT NULL,
  `pic3` varchar(5000) NOT NULL,
  `pic4` varchar(5000) NOT NULL,
  `pic5` varchar(5000) NOT NULL,
  `pic6` varchar(5000) NOT NULL,
  `uname` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `uname` (`uname`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;

--
-- Dumping data for table `cars`
--

INSERT INTO `cars` (`id`, `make`, `model`, `trans`, `fuel`, `year`, `km`, `vin`, `regdetails`, `state`, `price`, `features`, `pic1`, `pic2`, `pic3`, `pic4`, `pic5`, `pic6`, `uname`) VALUES
(14, 'ALFA ROMEO ', 'ALFA', 'Automatic', 'Gasoline/Petrol', 2009, 0, 0, 'Unregisted', 'Northern Territory', 'ASK', '<li>Anti-Lock Brakes(ABS)</li><li>Driver Airbag</li><li>Passenger Airbag</li><li>Side Airbag</li><li>Alarm</li><li>A/C:front</li><li>Cruise Control</li><li>Navigation System</li><li>Power Steering</li><li>Remote Keyless Entry</li><li>Tilt Wheel</li><li>Digital Meter</li><li>Child Seat</li><li>Leather Seats</li><li>Power Seats</li><li>Bucket Seat</li><li>Power Windows</li><li>Rear Window Wiper</li><li>Tinted Glass</li><li>AM/FM Radio</li><li>AM/FM Stereo</li><li>CD Changer</li><li>CD Player</li><li>Premium Sound</li><li>Satellite Radio</li><li>DVD</li><li>TV</li><li>Alloy Wheels</li><li>Power Door Locks</li><li>Power Mirrors</li><li>Sunroof</li><li>Third Row Seats</li><li>Power Slide Door</li><li>Custom wheels</li><li>Fully loaded</li><li>Maintenance records available</li><li>New paint</li><li>New tires</li><li>No accidents</li><li>One owner</li><li>Performance tires</li><li>Upgraded sound system</li><li>Turbo</li>', './adpics/AlfaRomeoC8.jpg', './adpics/Alfa-Romeo-8c-Competizione.jpg', './adpics/alfa-romeo-8c.jpg', './adpics/alfa-8c.jpg', './adpics/alfa8c.jpg', './adpics/2003_Alfa_Romeo_8C_Competizione_Concept.jpg', 'nirman'),
(11, 'BMW ', 'M3', 'Automatic', 'Diesel', 2007, 123, 0, 'Unregisted', 'Western Australia', 'ASK', '<li>Anti-Lock Brakes(ABS)</li><li>Driver Airbag</li><li>Passenger Airbag</li><li>Side Airbag</li><li>Alarm</li><li>Power Door Locks</li><li>Power Mirrors</li>', './adpics/2009_Camaro_1.jpg', './adpics/0007500089184_500X500.jpg', './adpics/0088732421005_AV_500X500.jpg', './adpics/AustraliaMap.png', './adpics/Iloverock.gif', './adpics/YeahIloverock.jpg', 'ruwanaru'),
(12, 'BMW ', 'M3', …
ruwanaru 0 Junior Poster in Training

In this db and query are working and the firs page but after the 2nd page the variables are not passing can any one help me on this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php 
  
  include("../init/db.php");
  
  $yearfom = $_POST["yearFrom"];
	$yearTo = $_POST["yearTo"];
	
	$Year ="SELECT";
	
	if($yearfom!="SELECT"){
		$Year ="";
		}
	
		$content = array("make"=>$_POST["make"],
					 "model"=>$_POST["model"],
					 "year"=>"$Year");


   
    $validValues=array();

	foreach ($content as $key=>$value)
	{
		if($value != "SELECT")
		  {
			 $validValues[$key]=$value;	
							
		  }
		  
	}
	
	$query ="select * from cars where ";
	foreach($validValues as $key=>$value)
	{

		$query1 = $query.$key."='".$value."' AND ";
		$qu1=true;
		if($key == "year"){
			$query1 = substr($query1,0,-8);
			$query2 = $query1." BETWEEN '".$yearfom."' AND ' ".$yearTo."' ";
			$qu1=false;
			$qu2=true;
			
			}
			
				
	}
	
	if($qu1==true){
	$query = substr($query1,0,-4);
	echo $sql = $query;
	
	}elseif($qu2==true){
		
		$query = $query2;
		echo $sql = $query;
		}		
  
  
// how many rows to show per page
$rowsPerPage = 2;

// by default we show first page
$pageNum = 1;

// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
    $pageNum = $_GET['page'];
}

// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
  
 
 
 
 
// $sql= "select * from cars where year BETWEEN '2007' AND ' 2009' ";
  $result=mysql_query($sql);
   $row=mysql_num_rows($result);
     
  while($info=mysql_fetch_array($result)){


    
	 $make = $info['make'];
	  $model = $info['model'];
	  $price = $info['price'];
	  $features = $info['features'];
	  $year= $info['year'];
	  
	 $pic1=$info['pic1'];
	 $pic2=$info['pic2'];
	  $pic3=$info['pic3'];
				   
		   
	  $id = $info['id'];
	  $desc=str_replace ("<li>", "   ", $features);
	  
	   $ftt = substr($desc,0,120)."................."; 
	    $abc="'viewad.php?id=$id'";


echo	'<div id="adcontent"><a  onclick="javascript:popUp('.$abc.')"">
	<div id="cars">
  			<div style="background-color:#0091DE; padding:5px; font-weight: bold; color:#FFF;">
   		 '.$make.' - '.$model.' -  '.$year.'
     	    </div>
 			 <div style="padding:10px; …
ruwanaru 0 Junior Poster in Training

this is my db table content

tble name : cars
id | make | model | trans | fuel | year | km | vin | regdetails | state | price | features

<form id="form1" name="F2" method="post" action="search.php">
  <div style="background-color:#84C8FD; text-align: center;"><h2>Find a Car</h2></div>
  <table width="224" border="0">
  <tr>
    <td width="42">Make</td>
    <td colspan="2"><label for="make"></label>
      <select name="make" id="master">
      <option value="SILECT">Select</option>      
      <option value="AC">AC </option>
      <option value="ALFA ROMEO ">ALFA ROMEO </option>
      <option value="ASIA ">ASIA </option>
      <option value="AMAROO ">AMAROO </option>
      <option value="ASTON MARTIN ">ASTON MARTIN </option>
      <option value="AUDI ">AUDI </option>
      <option value="AUSTIN ">AUSTIN </option>
      <option value="AUSTIN HEALEY ">AUSTIN HEALEY </option>
      <option value="BEDFORD ">BEDFORD </option>
      <option value="BENTLEY ">BENTLEY </option>
      <option value="BERTONE ">BERTONE </option>
      <option value="BMW ">BMW </option>
      </select></td>
    </tr>
  <tr>
    <td>Model</td>
    <td colspan="2"><label for="model"></label>
      <select name="model" id="slave">
      <option value="SELECT">Select</option>
      </select></td>
    </tr>
  <tr>
    <td>Year</td>
    <td width="80"><label for="yearfrom"></label>
      <select name="yearfrom" id="yearfrom">
      <option value="From">From</option>
      </select></td>
    <td width="80"><select name="yearto" id="yearto">
    <option value="To">To</option>
    </select></td>
  </tr>
  <tr>
    <td>Price</td>
    <td><select name="pricefrom" id="pricefrom">
    <option value="From">From</option>
    </select></td>
    <td><select name="priceto" id="priceto">
    <option value="To">To</option>
    </select></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input name="" type="submit" value="Search" />&nbsp;</td>
  </tr>
  </table>

  </form>

i want to search my db as like in car web site like this site

http://www.carsguide.com.au/

like the find car

im new in php so please help me with full scripts

sorry im not good in English for more explanation

ruwanaru 0 Junior Poster in Training

this is my db table content

tble name : cars
id | make | model | trans | fuel | year | km | vin | regdetails | state | price | features

what i want is search the car with this form

<form id="form1" name="F2" method="post" action="search.php">
  <div style="background-color:#84C8FD; text-align: center;"><h2>Find a Car</h2></div>
  <table width="224" border="0">
  <tr>
    <td width="42">Make</td>
    <td colspan="2"><label for="make"></label>
      <select name="make" id="master">
      <option value="SILECT">Select</option>      
      <option value="AC">AC </option>
      <option value="ALFA ROMEO ">ALFA ROMEO </option>
      <option value="ASIA ">ASIA </option>
      <option value="AMAROO ">AMAROO </option>
      <option value="ASTON MARTIN ">ASTON MARTIN </option>
      <option value="AUDI ">AUDI </option>
      <option value="AUSTIN ">AUSTIN </option>
      <option value="AUSTIN HEALEY ">AUSTIN HEALEY </option>
      <option value="BEDFORD ">BEDFORD </option>
      <option value="BENTLEY ">BENTLEY </option>
      <option value="BERTONE ">BERTONE </option>
      <option value="BMW ">BMW </option>
      </select></td>
    </tr>
  <tr>
    <td>Model</td>
    <td colspan="2"><label for="model"></label>
      <select name="model" id="slave">
      <option value="SELECT">Select</option>
      </select></td>
    </tr>
  <tr>
    <td>Year</td>
    <td width="80"><label for="yearfrom"></label>
      <select name="yearfrom" id="yearfrom">
      <option value="From">From</option>
      </select></td>
    <td width="80"><select name="yearto" id="yearto">
    <option value="To">To</option>
    </select></td>
  </tr>
  <tr>
    <td>Price</td>
    <td><select name="pricefrom" id="pricefrom">
    <option value="From">From</option>
    </select></td>
    <td><select name="priceto" id="priceto">
    <option value="To">To</option>
    </select></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input name="" type="submit" value="Search" />&nbsp;</td>
  </tr>
  </table>

  </form>

im new in php so please help me with full scripts

ruwanaru 0 Junior Poster in Training

thank you very much ......................

ruwanaru 0 Junior Poster in Training

any of those headers are not working

ruwanaru 0 Junior Poster in Training

i think u should check your document settings when you opening a new document

Color mode RGB or CMYK

ruwanaru 0 Junior Poster in Training

This is my codes what is the wrong with this :(

<?php 
session_start();              


include("../init/db.php");
$uname=$_POST['uname'];
$pass=$_POST['pass'];

echo $uname."<br />";
echo $pass;
$res ="";


$sql = "SELECT * FROM `users` WHERE uname='$uname'";
$result = mysql_query($sql);
$row=mysql_num_rows($result);

if($row==1){

	while($info=mysql_fetch_array($result)){	
		$pa=$info['pass'];
	
		if($pass==$pa){
			echo "pssaword mach";
			$_SESSION['LOGGED']=true;
			$_SESSION['uname']=$info['uname'];
			$_SESSION['fname']=$info['fname'];
                         header("Location:../usercp.php");                    
					
			}
		else{
			echo "password not mach";
			$res ="password not mach";
			header("Location:../login.php?error=2");
			}
		}
}else{
	
	echo "username dos not mach";
	header("Location:../login.php?error=1");
	}

?>
ruwanaru 0 Junior Poster in Training

This is the error

Warning: Cannot modify header information - headers already sent by (output started at /home/rejocoma/public_html/login-registor/do_login.php:9) in /home/rejocoma/public_html/login-registor/do_login.php on line 40

and this comming only on my hosting not in local machine ita unix hosting solution

can any one give me a help on this im a new in php and pleas give me a help...

Thank you.........

ruwanaru 0 Junior Poster in Training

can you show your codes some times we can get more idea from that

ruwanaru 0 Junior Poster in Training

ooooops thanx for the help
itz a big help for me ................................
thanx a lot

ruwanaru 0 Junior Poster in Training
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js"></script>
<script type="text/javascript">

function buildSelect(select, options)
{
    var select = $(select);
    select.empty();
    options.each(function(item) {
        if($type(item) != "array")
        {
            item = [item, item];
            var option = new Element("option", {
                text: item[0].toString(),
                value: item[1].toString()
            });
            option.inject(select);
        }
    });
}

function domready()
{
    $('master').addEvent('change', master_changed);
}

var cars = {
    "BMW": ["Z3", "Z4"],
    "Audi": ["A4", "A3"]
}

function master_changed()
{
    var s = $('master').get('value').trim();
    buildSelect('slave', cars[s]);
}


</script>
</head>

<body><form action="" method="post" name="F2" id="F2">
  <p>Make
    <select name="list" id="master">
      <option value="Audi">Audi</option>
      <option value="BMW">BMW</option>
    </select>
  </p>
  <p>Model
    <select name="select" id="slave">
      <option>SELECT</option>
    </select>
  </p>
</form>
</body>
</html>

this si also not working

ruwanaru 0 Junior Poster in Training

You download this file (which is mootools), add it to your webpages and add a reference to it in the head-section of the html-document using the code:

<script language="javascript" type="text/javascript" src="pathtomootoolsfile.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript" src="pathtomootoolsfile.js"></script>
<script type="text/javascript">

function buildSelect(select, options)
{
    var select = $(select);
    select.empty();
    options.each(function(item) {
        if($type(item) != "array")
        {
            item = [item, item];
            var option = new Element("option", {
                text: item[0].toString(),
                value: item[1].toString()
            });
            option.inject(select);
        }
    });
}

function domready()
{
    $('master').addEvent('change', master_changed);
}

var cars = {
    "BMW": ["Z3", "Z4"],
    "Audi": ["A4", "A3"]
}

function master_changed()
{
    var s = $('master').get('value').trim();
    buildSelect('slave', cars[s]);
}


function buildSelect(select, options)
{
    var select = $(select);
    select.empty();
    options.each(function(item) {
        if($type(item) != "array")
        {
            item = [item, item];
            var option = new Element("option", {
                text: item[0].toString(),
                value: item[1].toString()
            });
            option.inject(select);
        }
    });
}

function domready()
{
    $('master').addEvent('change', master_changed);
}

function master_changed()
{
    var req = new Request.JSON({
        url: 'getmodels.php',
        method: 'post',
        data: 'brand=' + encodeURIComponent($('master').get('value'))
    });
    req.addEvent('success', function(response) {
        buildSelect('slave', response);
    });
    req.send();
}
</script>
</head>

<body><form action="" method="post" name="F2" id="F2">
  <p>Make
    <select name="list" id="master">
      <option value="Audi">Audi</option>
      <option value="BMW">BMW</option>
    </select>
  </p>
  <p>Model
    <select name="select" id="slave">
      <option>SELECT</option>
    </select>
  </p>
</form>
</body>
</html>

is this correct this is not working