Jump to content

$@#$@ why is doing this???


scaleautostyle

Recommended Posts

Hi everyone... I try to adapt the previous coding to met my needs. but looklike it's not easy than was I think.

 

I receive this message when I it the submit button....

 

Notice: Undefined index: manufacturer_reel in ......search-db.php on line 18

select * from student whe

 

this is my code

 

<?php
include_once("db_connection.php");
//////////////////////////////
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>(Type a title for your page here)</title>
</head>

<body >
<?php

if (isset($_POST['todo']) && $_POST['todo'] == "search") {    $todo=$_POST['todo'];

$manufacturer_reel=$_POST['manufacturer_reel'];

$query="select * from kit where  ";

////////// Including manufacturer_reel field search ////
if(strlen($manufacturer_reel) > 0 ){
$query.= " manufacturer_reel='$manufacturer_reel' and "; 
}  
//// End of class field search ///////////

$query=substr($query,0,(strLen($query)-4));

echo $query;
echo "<br><br>";
$nt=mysql_query($query);
echo mysql_error();

// End if form submitted

}else{
echo "<form method=post action=''><input type=hidden name=todo value=search>";
$q=mysql_query("SELECT DISTINCT manufacturer_reel FROM kit ORDER BY manufacturer_reel");
echo '<select name=manufacturer_reel="manufacturer_reel"><option>Reel manufacturer</option>';

while($row = mysql_fetch_array($q)) {
$thing = $row['manufacturer_reel'];
echo '<option>'.$thing.'</option>';
}

echo "</select>"; 

echo "

<br><input type=submit value=Search name='name' action='search.php?go'>

</form>
";
}


?>

</body>

</html>

 

and this is my search-keyword.php file

 

that supposed to return the appropriate data.

 

thanks in advance

 

sebastien

 

<?php

include_once("db_connection.php");
//////////////////////////////
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>(Type a title for your page here)</title>

</head>

<body >
<?php
if (isset($_POST['todo']) && $_POST['todo'] == "search") {    $todo=$_POST['todo'];

$manufacturer_reel=$_POST['manufacturer_reel'];


//-query  the database table for the post field  
   $sql="SELECT  kit_id, kit_number, kit_name, description, manufacturer_kit, manufacturer_reel, scale, engine_detail, year_prod_kit, year_prod_reel, image_id, image_id1, image_id2  FROM kit WHERE manufacturer_reel LIKE '%" . $manufacturer_reel ."%'";  


  //-run  the query against the mysql query function   
   $result=mysql_query($sql);  
   
  //-make the header of the table   
   
   echo "  <table align=center width=\"1255\" border=\"\">\n";
   echo "    <tr>\n";
   echo"  <td nowrap align=center width='95'>  kit manufacturer  \n";		
   echo"  <td nowrap align=center width='55'>	scale \n";		
   echo"  <td nowrap align=center width='90'>	kit number \n";		
   echo"  <td nowrap align=center width='290'>	kit name \n";		
   echo"  <td nowrap align=center width='400'>	description \n";
   echo"  <td nowrap align=center width='95'>	vehicule manufacturer \n";
   echo"  <td nowrap align=center width='75'>	year of reel production of car \n";		
   echo"  <td nowrap align=center width='75'>	complete engine detail\n";		
   echo"  <td nowrap align=center width='75'>	Select Picture to get bigger\n";
   echo"  <td nowrap align=center width='75'>	instruction sheet\n";
   echo"  <td nowrap align=center width='50'>	box contain\n";
   echo "    <tr>\n";

   //-create  while loop and loop through result set   
   while($row=mysql_fetch_array($result)){   
         $description  =$row['description'];   
         $manufacturer_kit=$row['manufacturer_kit']; 
	 $scale=$row['scale']; 
	 $manufacturer_reel=$row['manufacturer_reel'];   
         $kit_id=$row['kit_id']; 
	 $kit_number=$row['kit_number'];
	 $kit_name=$row['kit_name'];
	 $engine_detail=$row['engine_detail'];
	 $year_prod_reel=$row['year_prod_reel'];
	 $image_id=$row['image_id'];
	 $image_id1=$row['image_id1'];
	 $image_id2=$row['image_id2'];


	   
   //-create  table of item during he while loop
   
echo "  <table align=center width=\"1255\" border=\"\">\n";		   
echo"  <td nowrap align=center width='95'>  $manufacturer_kit  \n";	
echo"  <td nowrap align=center width='95'>  $scale  \n";
echo"  <td nowrap align=center width='95'>  $manufacturer_reel  \n";	
echo"  <td nowrap align=center width='90'>	$kit_number \n";		
echo"  <td nowrap align=center width='290'>	$kit_name \n";		
echo"  <td nowrap width='400'>	$description \n";		
echo"  <td nowrap align=center width='75'>	$year_prod_reel \n";		
echo"  <td nowrap align=center width='75'>	$engine_detail \n";	
echo"  <td nowrap width='75'> <a href=".$image_id.">   <img src='".$image_id."' width='75' height='50' border='0'/>";
echo"  <td nowrap width='75'> <a href= ".$image_id1.">   <img src= 'http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>";
echo"  <td nowrap width='50'> <a href=".$image_id2.">   <img src='http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>";
echo "    </tr>\n";
echo "    </table>\n"; 
echo "    </tr>\n";
echo "    </table>\n";


   }   
   }  
   else{   
   echo  "<p>Please enter a search query</p>";   
   }   
   }   
   }
?>  

 

Link to comment
Share on other sites

You are generating improper HTML with this

<?php
echo '<select name=manufacturer_reel="manufacturer_reel"><option>Reel manufacturer</option>';
?>

Use

<?php
echo '<select name="manufacturer_reel><option>Reel manufacturer</option>';
?>

 

Ken

 

Link to comment
Share on other sites

thanks  kenrbnsn

 

but are you refering to the live in this code???

 

<?php // End if form submitted}else{echo "<form method=post action=''><input type=hidden name=todo value=search>";$q=mysql_query("SELECT DISTINCT manufacturer_reel FROM kit ORDER BY manufacturer_reel");echo '<select name=manufacturer_reel="manufacturer_reel"><option>Reel manufacturer</option>';while($row = mysql_fetch_array($q)) {$thing = $row['manufacturer_reel'];echo '<option>'.$thing.'</option>';?>

 

 

 

in the case of an afirnative answer you code doen't show my dropdown instead of mine where it show the dropdown.

 

I get the message when I hit the submit button so I think the error is on my searh=keyword file no ?? I know the message says

 

Notice: Undefined index: manufacturer_reel in ......search-db.php on line 18

select * from student whe

 

 

but .....

 

yours

 

sebastien

 

Link to comment
Share on other sites

sorry I don't why my code doesn't want to show in the last post there is it..

 

<?php // End if form submitted
}else{
echo "<form method=post action=''><input type=hidden name=todo value=search>";
$q=mysql_query("SELECT DISTINCT manufacturer_reel FROM kit ORDER BY manufacturer_reel");
echo '<select name=manufacturer_reel="manufacturer_reel"><option>Reel manufacturer</option>';

while($row = mysql_fetch_array($q)) {
?>

Link to comment
Share on other sites

thanks kenrbnsn your new code work... the dropdown is theyre. but now when I select a manufacturer anyone... here I took honda I got this result

 

 

select * from kit where manufacturer_reel='honda'

 

 

??? where did they came from in the search-keyword.php file ??

 

it's realy not that I want.

 

I see some error in my original work and change it so find below my 2 update file

 

The FORM

 

<?php
include_once("db_connection.php");
//////////////////////////////
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>(Type a title for your page here)</title>
</head>

<body >
<?php

if (isset($_POST['todo']) && $_POST['todo'] == "search") {    $todo=$_POST['todo'];

$manufacturer_reel=$_POST['manufacturer_reel'];

$query="select * from kit where  ";

////////// Including manufacturer_reel field search ////
if(strlen($manufacturer_reel) > 0 ){
$query.= " manufacturer_reel='$manufacturer_reel' and "; 
}  
//// End of class field search ///////////

$query=substr($query,0,(strLen($query)-4));

echo $query;
echo "<br><br>";
$nt=mysql_query($query);
echo mysql_error();

// End if form submitted

}else{
echo "<form method=post action=''><input type=hidden name=todo value=search>";
$q=mysql_query("SELECT DISTINCT manufacturer_reel FROM kit ORDER BY manufacturer_reel");
echo '<select name="manufacturer_reel"><option>Reel manufacturer</option>';

while($row = mysql_fetch_array($q)) {
$thing = $row['manufacturer_reel'];
echo '<option>'.$thing.'</option>';
}

echo "</select>"; 

echo "

<br><input type=submit value=Search name='name' action='search-keyword.php?go' >

</form>
";
}


?>

 

 

and the SEARCH-keyword.php where it supposed to return the info.

 

<?php

include_once("db_connection.php");
//////////////////////////////
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>(Type a title for your page here)</title>

</head>

<body >
<?php
if (isset($_POST['todo']) && $_POST['todo'] == "search") {    $todo=$_POST['todo'];

$name=$_POST['name'];


//-query  the database table for the post field  
   $sql="SELECT  kit_id, kit_number, kit_name, description, manufacturer_kit, manufacturer_reel, scale, engine_detail, year_prod_kit, year_prod_reel, image_id, image_id1, image_id2  FROM kit WHERE manufacturer_reel LIKE '%" . $name ."%'";  


  //-run  the query against the mysql query function   
   $result=mysql_query($sql);  
   
  //-make the header of the table   
   
   echo "  <table align=center width=\"1255\" border=\"\">\n";
   echo "    <tr>\n";
   echo"  <td nowrap align=center width='95'>  kit manufacturer  \n";		
   echo"  <td nowrap align=center width='55'>	scale \n";		
   echo"  <td nowrap align=center width='90'>	kit number \n";		
   echo"  <td nowrap align=center width='290'>	kit name \n";		
   echo"  <td nowrap align=center width='400'>	description \n";
   echo"  <td nowrap align=center width='95'>	vehicule manufacturer \n";
   echo"  <td nowrap align=center width='75'>	year of reel production of car \n";		
   echo"  <td nowrap align=center width='75'>	complete engine detail\n";		
   echo"  <td nowrap align=center width='75'>	Select Picture to get bigger\n";
   echo"  <td nowrap align=center width='75'>	instruction sheet\n";
   echo"  <td nowrap align=center width='50'>	box contain\n";
   echo "    <tr>\n";

   //-create  while loop and loop through result set   
   while($row=mysql_fetch_array($result)){   
         $description  =$row['description'];   
         $manufacturer_kit=$row['manufacturer_kit']; 
	 $scale=$row['scale']; 
	 $manufacturer_reel=$row['manufacturer_reel'];   
         $kit_id=$row['kit_id']; 
	 $kit_number=$row['kit_number'];
	 $kit_name=$row['kit_name'];
	 $engine_detail=$row['engine_detail'];
	 $year_prod_reel=$row['year_prod_reel'];
	 $image_id=$row['image_id'];
	 $image_id1=$row['image_id1'];
	 $image_id2=$row['image_id2'];


	   
   //-create  table of item during he while loop
   
echo "  <table align=center width=\"1255\" border=\"\">\n";		   
echo"  <td nowrap align=center width='95'>  $manufacturer_kit  \n";	
echo"  <td nowrap align=center width='95'>  $scale  \n";
echo"  <td nowrap align=center width='95'>  $manufacturer_reel  \n";	
echo"  <td nowrap align=center width='90'>	$kit_number \n";		
echo"  <td nowrap align=center width='290'>	$kit_name \n";		
echo"  <td nowrap width='400'>	$description \n";		
echo"  <td nowrap align=center width='75'>	$year_prod_reel \n";		
echo"  <td nowrap align=center width='75'>	$engine_detail \n";	
echo"  <td nowrap width='75'> <a href=".$image_id.">   <img src='".$image_id."' width='75' height='50' border='0'/>";
echo"  <td nowrap width='75'> <a href= ".$image_id1.">   <img src= 'http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>";
echo"  <td nowrap width='50'> <a href=".$image_id2.">   <img src='http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>";
echo "    </tr>\n";
echo "    </table>\n"; 
echo "    </tr>\n";
echo "    </table>\n";


   }   
   }  
   else{   
   echo  "<p>Please enter a search query</p>";   
   }   
   }   
   }
?>  

 

yours

 

sebastien

Link to comment
Share on other sites

The "action" attribute is meaningless in a "<input>" tag. When you submit a form it goes to the script in the "action" attribute in the "<form>" tag. In your case that is the empty string, which says submit the data to the original script. If you want it to go somewhere else, put the script name there.

 

Ken

Link to comment
Share on other sites

ok but at the end of my form where my submit button is I say the action where to go

 

<?php
// End if form submitted
}else{echo "<form method=post action=''><input type=hidden name=todo value=search>";$q=mysql_query("SELECT DISTINCT manufacturer_reel FROM kit ORDER BY manufacturer_reel");echo '<select name="manufacturer_reel"><option>Reel manufacturer</option>';while($row = mysql_fetch_array($q)) {$thing = $row['manufacturer_reel'];echo '<option>'.$thing.'</option>';}echo "</select>"; echo "<br><input type=submit value=Search name='name' action='search-keyword.php?go' ></form>";} 
?>

where other else I have to put the info??

 

yours

 

sebastien

Link to comment
Share on other sites

HA!!!  I just see it      thanks

 

now I redo and it start something. it echo my table header but doesn't run the sql query to display something.

 

these code was working number one when I do it with a texte search field. now why it doesn't work in this one.????

 

see the code in the previous post... search-kewyword.php

 

thaks

 

 

sebastien

Link to comment
Share on other sites

You are searching on the value in $_POST['name'], but your form is passing $_POST['manufacturer_reel']

Change:

<?php
$name=$_POST['name'];
//-query  the database table for the post field  
   $sql="SELECT  kit_id, kit_number, kit_name, description, manufacturer_kit, manufacturer_reel, scale, engine_detail, year_prod_kit, year_prod_reel, image_id, image_id1, image_id2  FROM kit WHERE manufacturer_reel LIKE '%" . $name ."%'"; 
?>

to

<?php
$manufacturer_reel=$_POST['manufacturer_reel'];
//-query  the database table for the post field  
   $sql="SELECT  kit_id, kit_number, kit_name, description, manufacturer_kit, manufacturer_reel, scale, engine_detail, year_prod_kit, year_prod_reel, image_id, image_id1, image_id2  FROM kit WHERE manufacturer_reel LIKE '%" . $manufacturer_reel."%'"; 
?>

 

Ken

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.