sugikrish 0 Junior Poster in Training

hi....

I want populate combo box based on another combobox selection in php.

for eg: If we select 'tamilnadu' in one combobox then tamilnadu district are displayed in another combobox.

If you know send that coding.

Thanks in advance

sugikrish 0 Junior Poster in Training

Hi frnds,

I need display mysql field as check box value.

<?php

         mysql_connect("localhost","root","");
         mysql_select_db("postal") or die(mysql_error());


        $query = mysql_query("SELECT name FROM register");

    while ($row = mysql_fetch_assoc($query)) {

        $tag = $row['name'];

        echo "<input type='checkbox' name='register[]' [U]value='$tag'[/U] />\n";

    }

    ?>

here i paste my code here. it displayed only checkboxes. not value.any one know this send the corrections.

sugikrish 0 Junior Poster in Training

i frnds,


Many times i try to retrieve image from database. Successfully it upload to database. but cant retrieve. any one know this?


Thanks in advance....

sugikrish 0 Junior Poster in Training

Hi frnds,


I want the source codew for converting any one format to pdf. Any one know abt this pls help to me.

Thanks in advance.

sugikrish 0 Junior Poster in Training

Hi frnds,


I want activate the textbox when i select the particular checkbox in php.Anybody know send that coding ......

sugikrish 0 Junior Poster in Training

Hi Frnds,

I created session for index page. I passed session variable to next page like "about us" page. But in index page it displayed some errors.

Notice: Undefined index: myusername in C:\wamp\www\fc2\index.php on line 136

Notice: Undefined index: mypassword in C:\wamp\www\fc2\index.php on line 137

Line 136 : $myusername=$_POST;

Line 137 : $mypassword=$_POST;

this enough for find error or i paste my full program?
if you know help me pls.

sugikrish 0 Junior Poster in Training

Hi frnd,

Actually i write program for storing image path in database and retrieve the path then display image. if you know the code pls send me.

sugikrish 0 Junior Poster in Training

Hi frnd,

I used this coding. but it didnt display the value. now i paste my code and output here. Otherwise if you can give full coding for retrieving image from database.

seimg.php

<body>

    <form action="seimg.php">
    Enter image id:<input type="text" name="foo" />
    <input type="submit" name="submit" value="show" />

    <?php

    $username = "root";
    $password = "";
    $host = "localhost";
    $database = "simg";

    @mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());

    @mysql_select_db($database) or die("Can not select the database: ".mysql_error());



      //check that $_POST['foo'] exists

      if (isset($_POST['foo'])) {

      //$_POST['foo'] exists

      $foo = $_POST['foo']; //we might perform input validation here

      } else {

      //$_POST['foo'] does not exist

     $foo = ''; //assign a default value

      }


      //use $foo

      echo $foo;


    $query = mysql_query("SELECT * FROM img WHERE id='".$foo."'");
$row = mysql_fetch_array($query);
$content = $row['image'];

header('Content-type: image/jpg');
echo $content;


    ?>

       </form>


</body>
</html>

Output:

[url]http://localhost/base/seimg.php?foo=1&submit=show[/url]
sugikrish 0 Junior Poster in Training

the same error:
"Notice: Undefined index: field in C:\wamp\www\base\seimg.php on line 24"

sugikrish 0 Junior Poster in Training

Hi frnd,

really thanks for reply. But again it shows an error. Can you help me for this?

sugikrish 0 Junior Poster in Training

actually error pointing

$b =$_GET; this line only. i dont know wat error in this line. Any one know say to me.

sugikrish 0 Junior Poster in Training

Hi frnds,

I did same wat u said. but it shows an error. I dont know. if u can pls say to me. I paste my code here.

seimg.php

<body>

<form action="seimg.php">
Enter image id:<input type="text" name="field" />
<input type="submit" name="submit" value="show" />

<?php

$username = "root";
$password = "";
$host = "localhost";
$database = "simg";

@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());

@mysql_select_db($database) or die("Can not select the database: ".mysql_error());

$b =$_GET['field'];

$query = mysql_query("SELECT image FROM img WHERE id='$b'");

 $row = mysql_fetch_array($query);
 
 
 
echo "<img src='".$row['image']."' />";

   
      



?>  
   
  
</form>

it shows "Notice: Undefined index: field in C:\wamp\www\base\seimg.php on line 24" this error.

sugikrish 0 Junior Poster in Training

I used this. But it shows an error."Parse error: parse error in C:\wamp\www\base\seimg.php on line 30"

line 30:echo "<img src='". <?php echo $row?>."' />";

sugikrish 0 Junior Poster in Training

Hi frnds,

I used $b =$_REQUEST; It shows error in this line."Notice: Undefined index: field in C:\wamp\www\base\seimg.php on line 24" .

sugikrish 0 Junior Poster in Training

Hi..

1.
$query = mysql_query("SELECT * FROM img WHERE id='$b'");
2.

3.
$row = mysql_fetch_array($query);
4.
echo "<img src='".$content = $row."' />";

this coding working.But it not displayed image. It displayed some binary data. wat error in this ?

sugikrish 0 Junior Poster in Training

hi frnd,

I use that link and do the same way. but i dont know how link one file to another in this program . successfully image downloaded, but not stored into database. can you help me?

sugikrish 0 Junior Poster in Training

Hi frnds,


I want to store images in database and retrieve. I can successfully stored. But i dont know how retrieve it. If any one know pls help me. I paste my code here.

fimg.php

<body>
<form enctype="multipart/form-data" action="insert.php" method="post" name="changer">
<input name="MAX_FILE_SIZE" value="102400" type="hidden">
<input name="image" accept="image/jpeg" type="file">
<input value="Submit" type="submit">
</form>
</body>

insert.php

<?php
$username = "root";
$password = "";
$host = "localhost";
$database = "simg";

$link = mysql_connect($host, $username, $password);
if (!$link) {
    die('Could not connect: ' . mysql_error());
}


mysql_select_db ($database);  
if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { 

      
      $tmpName  = $_FILES['image']['tmp_name'];  
       
     
      $fp      = fopen($tmpName, 'r');
      $data = fread($fp, filesize($tmpName));
      $data = addslashes($data);
      fclose($fp);
      



      $query = "INSERT INTO img";
      $query .= "(image) VALUES ('$data')";
      $results = mysql_query($query, $link);
      

      print "Thank you, your file has been uploaded.";
      
}
else {
   print "No image selected/uploaded";
}


mysql_close($link);

?>

seimg.php

<form action="seimg.php">
Enter image id:<input type="text" name="field" />
<input type="submit" name="submit" value="show" />

<?php

$username = "root";
$password = "";
$host = "localhost";
$database = "simg";

@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());

@mysql_select_db($database) or die("Can not select the database: ".mysql_error());

$b =$_REQUEST['field'];

$query = mysql_query("SELECT * FROM img WHERE id='$b'");

$row = mysql_fetch_array($query);
$content = $row['image'];

?>
sugikrish 0 Junior Poster in Training

Thanks for your reply.

sugikrish 0 Junior Poster in Training

Really thanks urtrivedi and rajarajan. Now am working on it.

sugikrish 0 Junior Poster in Training

I dont know how checked in phpmyadmin. Bcoz i write query like "$idvalue=$_REQUEST". So according user selection it will retrieve the values. I don't know how check it in phpmyadmin.

sugikrish 0 Junior Poster in Training

1) I need "where" condition for the first query only for retrieving values from table.
I passed id from php . This id passed to next detail.php file like $idvalue=$_REQUEST; Then retrieve value from old table using where id='$idvalue.This underline id is one field of old table.

sugikrish 0 Junior Poster in Training

k frnd.

sugikrish 0 Junior Poster in Training

Ya echo "$idvalue" display the value. just I want retrieve some values from existing table and posted into new table. I used where condition here for retrieve values. But no condition for storing values.already i done this in following way. select from one table and printed in one place and then moved to another table. I thing this long process. so only i need this way. sorry frnd my query also too long.

sugikrish 0 Junior Poster in Training

Hi thanks for your reply.......

Just I insert your coding in phpmy admin it produce the following error.

Error

SQL query:

$query = "insert into orde values('$projectid','$projectname','$projectcat','$scope','$location','$rate')";

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$query="insert into orde values('$projectid','$projectname','$projectcat','$scop' at line 1

And I add some codings with this then i show some error

    "select * from smenu where id='$idvalue'";

         while($row=mysql_fetch_array($result))
         {

         $projectid=$row['id'];
         $projectname=$row['main'];
         $projectcat= $row['itemm'];
         $scope=$row['descrip'];
         $location=$row['Category'];
         $rate=$row['Rate'];

        }

       $query="insert into orde values('$projectid','$projectname','$projectcat','$scope','$location','$rate')";
           $dbase=mysql_query($query);
            echo $dbase;
            error_reporting(E_ALL);
ini_set("display_errors", 1);    

error

Error

Error

SQL query: Documentation

"select * from smenu where id='$idvalue'";

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"select * from smenu where id='$idvalue'"' at line 1
sugikrish 0 Junior Poster in Training

echo statement not necessary here. just i know , items are displayed are not.I used ur query. But still didn't store values in table.

sugikrish 0 Junior Poster in Training

All items are displayed using echo statement. but not stored in table . not shown any error.

sugikrish 0 Junior Poster in Training

Hi frnds,

I need to select some values in old table and send it into newtable. Here i placed my program. Anybody know say the corrections.

<?php

mysql_connect("localhost","root","");
mysql_select_db("menus") or die(mysql_error());


$idvalue=$_REQUEST['id'];
//$iv=$_REQUEST['z'];

 $result=mysql_query("select * from smenu where id='$idvalue'");

     while($row=mysql_fetch_array($result))
     {

     $projectid=$row['id'];
     $projectname=$row['main'];
     $projectcat= $row['itemm'];
     $scope=$row['descrip'];
     $location=$row['Category'];
     $rate=$row['Rate'];

     }
     echo " $projectid,$projectname,$projectcat,$scope,$location,$rate";


    $query="insert into orde values('$projectid','$projectname','$projectcat','$scope','$location','$rate' where id='$idvalue')";
       $dbase=mysql_query($query);
        echo "$dbase";     
     ?> 

</body>
</html>
sugikrish 0 Junior Poster in Training

k frnd.

sugikrish 0 Junior Poster in Training

$sq="Select SUM(total) from bill where invoiceno=$q";
$r=mysql_query($sq);
echo "</table>";
echo "Total";
echo $r;


I try this coding. But it shows me an output "TotalResource id #5".But the original answer is 39. any error this coding? Ask me frnd..

sugikrish 0 Junior Poster in Training

now i try this frnd. but one more doubt. Now i clearly say.

insert into table2 , select * from table1 ( It table1 have some empty field). I try to do this Retrieve value from one table and stored into another table. I dont know how do it nu......

sugikrish 0 Junior Poster in Training

Really very very thanks of this...

sugikrish 0 Junior Poster in Training

Hi frnds,

I need to perform calculation in same field .
$sql="SELECT itemcode,itemname,quantity,price,total,remarks,SUM(total) FROM bill WHERE invoiceno = '".$q."'";

Is this query possible?anybody know say to me pls.

sugikrish 0 Junior Poster in Training

Add Item.php

<body>
<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getite.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form action="getite.php">
<h3><a href="getitem.php">Add Item</a></h3>
<h3><a href="http://localhost/da/logi.php">Home</a></h3><br/>
<?php
error_reporting(0);
    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());

$query="SELECT DISTINCT main FROM smenu";


$result = mysql_query ($query);
echo "<select name='sers' onchange='showUser(this.value)'>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){
echo "<option value='$nt[main]'>$nt[main]</option>";



}

echo "</select>";


?> 
<div id="txtHint"><b>Items info will be listed here.</b></div>
</form>
</body>
</html>

getite.php

<body>
<?php
$q=$_GET["q"];
echo "$q";
error_reporting(0);
    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());


    $sql="SELECT * FROM smenu WHERE main = '".$q."'";

$result = mysql_query($sql);


         mysql_close($con);
         echo "<table width=900 border=1>";
        echo "<tr bgcolor=#ccccc>";
        echo  "<th width=80 scope=col>id</th>";
        echo " <th width=100 height=34 scope=col>Item</th>";
        echo "<th width=500 scope=col><div align=center>Description</div></th>";
        echo "<th width=300 scope=col><div align=center>Category</div></th>";
        echo "<th width=94 scope=col>Rate</th>";
        echo "<th width=94 scope=col>Order Item</th>";
        echo "</tr>";

         while($row=mysql_fetch_array($result))
         {
         echo "<tr><td align='center'>";
         echo $row['id'];
         echo "</td><td align='center'>";
         echo $row['itemm']; 
         echo "</td><td align='left'>";
         $chec=$row['descrip'];
         if ($chec == ' ' or $chec == Null)

echo 'NILL';

else
         echo $row['descrip'];
         echo "</td><td align='center'>";

$check = $row['Category'];

if ($check == ' ' or $check == Null)

echo 'NILL';

else
         echo $row['Category'];
         echo "</td><td align='center'>";
         echo $row['Rate'];
         echo "</td><td align='center'>";
echo "<a href=detail.php?id=".$row['id'].">Order</a>";
          echo "</td></tr>";
         }
         echo "</table>";

            ?>

</body>
</html>

detail.php

 <form id="form1" name="form1" method="post" action="accep.php">
    <?php

    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());


    $idvalue=$_REQUEST['id']; …
sugikrish 0 Junior Poster in Training

Really very thanks frnds. I got error when I insert empty field into table.

sugikrish 0 Junior Poster in Training

How we avoid this error. If I enter something empty field it displays following error.

Notice: Undefined index: ploca in C:\wamp\www\data\accep.php on line 20
Notice: Undefined index: psco in C:\wamp\www\data\accep.php on line 19

sugikrish 0 Junior Poster in Training

Hi ..........

I attached screen shot with this thread. is this possible for calculating these two values and display the same page. This values retrieve from database.

sugikrish 0 Junior Poster in Training

Really thanks . I successfully storing values.

sugikrish 0 Junior Poster in Training

I got this error message

Notice: Undefined index: plo in C:\wamp\www\data\accep.php on line 19
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order values('1','starters','Edamame','Steamed','','4.95')' at line 1

sugikrish 0 Junior Poster in Training

Notice: Undefined index: plo in C:\wamp\www\data\accep.php on line 19
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order values('1','starters','Edamame','Steamed','','4.95')' at line 1

sugikrish 0 Junior Poster in Training

Hi friends,

I get some error for storing into database. I given that coding.any body know pls say to me.

accep.php

<?php


         $check=$_REQUEST['submit'];
        mysql_connect("localhost","root","");
        mysql_select_db("menus") or die(mysql_error());

         $projectid=$_REQUEST['pid'];
          $projectname= $_REQUEST['pname'];
         $projectcat=  $_REQUEST['pcat'];
         $scope=$_REQUEST['psco'];
         $location=$_REQUEST['plo'];
         $rate=$_REQUEST['prate'];



           $query="insert into order values('$projectid','$projectname','$projectcat','$scope','$location','$rate')";
           $dbase=mysql_query($query) or die(mysql_error());
                 if($dbase==TRUE)
                   {
                   include("congrat.php");
                   }



?>

Detail.php

<body>
<h3> <a href="additem.php">View Menu</a></h3>
  <form id="form1" name="form1" method="post" action="accep.php">
    <?php

    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());


    $idvalue=$_REQUEST['id'];




     $result=mysql_query("select * from smenu where id='$idvalue'");

         while($row=mysql_fetch_array($result))
         {

         $projectid=$row['id'];
         $projectname= $row['main'];
         $projectcat=  $row['itemm'];
         $scope=$row['descrip'];
         $location=$row['Category'];
         $rate=$row['Rate'];

         }
         echo "<input type='hidden' value=".$projectid." name=pid>";
         echo "<input type='hidden' value=".$projectname." name=pname>";
         echo "<input type='hidden' value=".$projectcat." name=pcat>";
         echo "<input type='hidden' value=".$scope." name=psco>";
         echo "<input type='hidden' value=".$location." name=plo>";
         echo "<input type='hidden' value=".$rate." name=prate>";


        /*
          echo " project name is $projectname";
         if($check==="Request for this")
         {
         echo " project id is $projectid <br>";
         echo "check value is $check"; 
         }*/
?>

                    <table width="380" height="363" border="0" align="center" cellpadding="4" cellspacing="3" >
                      <tr>
                        <td width="135">Item Id </td>
                        <td width="211"><?php  echo $projectid; ?></td>
                      </tr>
                      <tr>
                        <td>Main Item </td>
                        <td><?php  echo $projectname; ?></td>
                      </tr>
                      <tr>
                        <td>Item Name</td>
                        <td><?php  echo $projectcat; ?></td>
                      </tr>

                      <tr>
                        <td height="83">Description</td>
                        <td><?php  echo $scope; ?></td>
                      </tr>
                       <tr>
                        <td height="83">Category</td>
                        <td><?php  echo $location; ?></td>
                      </tr>
                       <tr>
                        <td>Rate</td>
                        <td><?php  echo $rate; ?></td>
                      </tr>

                      <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td><input name="submit" type="submit" id="submit" value="Order this" /></td>
                      </tr>
                    </table>
sugikrish 0 Junior Poster in Training

additem.php

<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getite.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form action="getite.php">
<h3><a href="getitem.php">Add Item</a></h3><br/>

<?php
error_reporting(0);
    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());

$query="SELECT DISTINCT main FROM smenu";


$result = mysql_query ($query);
echo "<select name='sers' onchange='showUser(this.value)'>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){
echo "<option value='$nt[main]'>$nt[main]</option>";



}

echo "</select>";


?> 
<div id="txtHint"><b>Items info will be listed here.</b></div>
</form>
</body>
</html>

getite.php

<?php
$q=$_GET["q"];
echo "$q";
error_reporting(0);
    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());


    $sql="SELECT * FROM smenu WHERE main = '".$q."'";

$result = mysql_query($sql);


         mysql_close($con);
         echo "<table width=800 border=1 cellspacing=2>";
        echo "<tr bgcolor=#ccccc>";
        echo " <th width=100 height=34 scope=col>Item</th>";
        echo "<th width=500 scope=col><div align=center>Description</div></th>";
        echo "<th width=300 scope=col><div align=center>Category</div></th>";
        echo "<th width=94 scope=col>Rate</th>";
        echo "<th width=94 scope=col>Order Item</th>";
        echo "</tr>";

         while($row=mysql_fetch_array($result))
         {
         echo "<tr><td align='center'>";
         echo $row['itemm']; 
         echo "</td><td align='left'>";
         echo $row['descrip'];
         echo "</td><td align='center'>";
         echo $row['Category'];
         echo "</td><td align='center'>";
         echo $row['Rate'];
         echo "</td><td align='center'>";
         echo "order this";

         }
         echo "</table>";

            ?>

</body>
</html>

If Click "order this", then the particular item goes to separate database. How to do this..

sugikrish 0 Junior Poster in Training

i cant attached document in existing thread. there is no option. "Insert Link" only available.

sugikrish 0 Junior Poster in Training

I attached screen shot with this thread. how we display data from database without null values.

sugikrish 0 Junior Poster in Training

Really thanks for quick reply. I attach one more screen shot. I used list and select the value it retrieve data from database. some fields only empty. You see attachment you get clear idea of my question.

sugikrish 0 Junior Poster in Training

hi........

I want display data from database. I done it. but some fields have null values. it display empty field . I attached screen shot with this. If you know the solution pls say to me.

sugikrish 0 Junior Poster in Training

hi friends,

I used following code for automatically incrementing value and stored in database. This working but it have small problem. when I submit value then only incrementing. ex, i entered details for invoice number 2, but it showing invoice number 1.

 <?php

       mysql_connect("localhost","root","") or die(mysql_error());
   mysql_select_db("menus") or die(mysql_error());
   $query2=mysql_query("select invoiceno from bill");

    while($row=mysql_fetch_array($query2))
      {
       $var=$row['invoiceno'];
      }
     $count=$var+1;
     echo $count;

  ?>

anybody knowing result for pls help to me.

sugikrish 0 Junior Poster in Training

i want select values in list ,then it automatically stored in database. how to do ?
if anybody know say to me....

sugikrish 0 Junior Poster in Training

ya i try this. its working. i have one more doubt. values from list to text box successfully working. using this value can we retrieve data from database and displayed in another text box. u cant understand na i will send screen shot.

sugikrish 0 Junior Poster in Training

Thanks...

sugikrish 0 Junior Poster in Training

hi friends,

i want calculating values in two text box , result display in another text box and this result will be stored in database. if anybody know this say to me..