Kan iemand mij misschien helpen?

Mijn vraag is:

Ik zoek een product dit resultaat laat hij vervolgens zien.
maar dan moet je eerst klikken op dit product om vervolgens het te selecteren kan iemand mij vertellen hoe ik dit automatish kan laten gebeuren?

<?
$item_result=mysql_query($query,$dbf_osc->conn);

$item_title=isset($_SESSION['current_item_search']) ? "<b><font color=white>$lang->selectItem</font></b>":"<font color=white>$lang->selectItem</font>";
echo "<tr>

<td colspan='4' align='left'><font color=white>$lang->findItem:</font>
<input type='text' size='8' name='item_search'>
<input type='submit' value='zoek' tabindex='3'> <a href='delete.php?action=item_search'><font size='-1' color='white'>[$lang->clearSearch]</font></a></td></tr>";
?>
gooi dat script maar weg, ik weet niet waar je het voor gebruikt, maar het is slecht.
- geen foutafhaneling
- veel te veel html in je php

maar wat bedoel je? bedoel je dat je net als op een webshop onder ieder product specificaties ziet staan, of dat wanneer je eroverheen hovert specificaties te zien zijn?
Nee het gaat om een kassa je scant de barcode in krijgt 1 resultaat die moet je selecteren en dan op volgende drukken en dan laat hij het product zien.

dus het is een overbodige stap die ik er graag uit wil hebben of dat het resultaat gelijk geselecteerd word zodat je gewoon gelijk volgende kan drukken zonder het product eerst aan te moeten klikken

[size=xsmall]Toevoeging op 07/05/2012 16:36:10:[/size]

Hier wat meer van het script

<?
//updating row for an item already in sale.
if(isset($_GET['update_item']))
{

$k=$_GET['update_item'];
$new_price=$_POST["price$k"];
$new_tax=$_POST["tax$k"];
$new_quantity=$_POST["quantity$k"];

$item_info=explode(' ',$_SESSION['items_in_sale'][$k]);
$item_id=$item_info[0];

$_SESSION['items_in_sale'][$k]=$item_id.' '.$new_price.' '.$new_tax.' '.$new_quantity;


}
if(isset($_POST['addToCart']))
{

if(empty($_POST['items']))
{
echo "<b>$lang->youMustSelectAtLeastOneItem</b><br>";
echo "<a href='sale_ui.php'>$lang->refreshAndTryAgain</a>";
exit();

}



$items_to_add=array();
$items_to_add=$_POST['items'];
$quantity_to_add=$_POST['quantity'];

for($k=0;$k<count($items_to_add);$k++)
{
$_SESSION['items_in_sale'][]=$items_to_add[$k].' '.$quantity_to_add;

}


}

$display->displayTitle("$lang->newSale1");
echo "<center><form name='additem' method='POST' action='sale_ui.php'>
<table border=0 cellspacing='0' cellpadding='2' bgcolor='$table_bg'>";



if(isset($_POST['item_search']) and $_POST['item_search']!='')
{
$search=$_POST['item_search'];
$_SESSION['current_item_search']=$search;
$query="SELECT p.products_id,p.products_quantity,p.products_model,pd.products_name,p.products_price,tr.tax_rate
FROM products as p,products_description as pd,tax_rates as tr,tax_class as tc
WHERE p.products_id=pd.products_id and
p.products_tax_class_id=tc.tax_class_id and
tr.tax_class_id=tc.tax_class_id and
p.products_model like \"%$search%\"
and pd.language_id=1
ORDER by pd.products_name"; }
elseif(isset($_SESSION['current_item_search']))
{
$search=$_SESSION['current_item_search'];
$query="SELECT p.products_id,p.products_quantity,p.products_model,pd.products_name,p.products_price,tr.tax_rate
FROM products as p,products_description as pd,tax_rates as tr,tax_class as tc
WHERE p.products_id=pd.products_id and
p.products_tax_class_id=tc.tax_class_id and
tr.tax_class_id=tc.tax_class_id and
p.products_model like \"%$search%\"
and pd.language_id=1
ORDER by products_description.products_name";

}
else
{
$query="SELECT p.products_id,p.products_model,pd.products_name,p.products_price,tr.tax_rate
FROM products as p,products_description as pd,tax_rates as tr,tax_class as tc
WHERE p.products_id=pd.products_id and
p.products_tax_class_id=tc.tax_class_id and
tr.tax_class_id=tc.tax_class_id and pd.language_id=1 ORDER by pd.products_name";

}



$item_result=mysql_query($query,$dbf_osc->conn);

$item_title=isset($_SESSION['current_item_search']) ? "<b><font color=white>$lang->selectItem</font></b>":"<font color=white>$lang->selectItem</font>";
echo "<tr>

<td colspan='4' align='left'><font color=white>$lang->findItem:</font>
<input type='text' size='8' name='item_search'>
<input type='submit' value='zoek' tabindex='3'> <a href='delete.php?action=item_search'><font size='-1' color='white'>[$lang->clearSearch]</font></a></td></tr>";



echo "<tr><td colspan='4' align='center'>$item_title</td></tr>
<tr><td align='center' colspan='4'>
<select name='items[]' multiple size='8'>\n";

while($row=mysql_fetch_assoc($item_result))
{
$id=$row['products_id'];
$unit_price=$row['products_price'];
$tax_percent=$row['tax_rate'];
$option_value=$id.' '.$unit_price.' '.$tax_percent;
$display_item="$row[products_name]";
echo "<option value='$option_value'>$display_item</option>\n";

}
echo "</select></td></tr></center>

<tr><td align='center' colspan='4'><font color=white>$lang->quantity:</font> <input type='text' size='4' name='quantity' value='1'>
<input type='submit' value='Ga verder' name=addToCart tabindex='1'></td></tr></table></form>";


if(empty($_SESSION['items_in_sale']))
{
echo "<center><h3>$lang->yourShoppingCartIsEmpty</h3></center>";
}
if(isset($_SESSION['items_in_sale']))
{
$num_items=count($_SESSION['items_in_sale']);
$temp_item_name='';
$temp_item_id='';
$temp_quantity='';
$temp_price='';
$finalSubTotal=0;
$finalTax=0;
$finalTotal=0;
$totalItemsPurchased=0;

$item_info=array();



echo "<hr><center><a href=delete.php?action=all>[Clear Sale]</a><h3>$lang->shoppingCart</h3><form name='add_sale' action='addsale.php' method='POST'>
";
echo "<table border='0' bgcolor='$table_bg' cellspacing='0' cellpadding='2'>
<tr><th><font color=CCCCCC>$lang->remove</font></th>
<th><font color=CCCCCC>$lang->itemName</font></th>
<th><font color=CCCCCC>$lang->unitPrice</font></th>
<th><font color=CCCCCC>$lang->tax %</font></th>
<th><font color=CCCCCC>$lang->quantity</font></th>
<th><font color=CCCCCC>$lang->quantityStock</font></th>
<th><font color=CCCCCC>$lang->extendedPrice</font></th>
<th><font color=CCCCCC>$lang->update</font></th></tr>";
for($k=0;$k<$num_items;$k++)
{
$item_info=explode(' ',$_SESSION['items_in_sale'][$k]);
$temp_item_id=$item_info[0];

$query="SELECT pd.products_name,p.products_quantity FROM products as p,products_description as pd
WHERE p.products_id=pd.products_id and
p.products_id=\"$temp_item_id\"";

$result=mysql_query($query,$dbf_osc->conn);
$row=mysql_fetch_assoc($result);
$temp_item_name=$row['products_name'];
$temp_price=$item_info[1];
$temp_tax=$item_info[2];
$temp_quantity=$item_info[3];
$products_quantity=$row['products_quantity'];


$subTotal=$temp_price*$temp_quantity;
$tax=$subTotal*($temp_tax/100);
$rowTotal=$subTotal+$tax;
$rowTotal=number_format($rowTotal,2,'.', '');

$finalSubTotal+=$subTotal;
$finalTax+=$tax;
$finalTotal+=$rowTotal;
$totalItemsPurchased+=$temp_quantity;


echo "<tr><td align='center'><a href=delete.php?action=item&pos=$k><font color=white>[$lang->delete]</font></a></td>
<td align='center'><font color='white'><b>$temp_item_name</b></font></td>
<td align='center'><input type=text name='price$k' value='$temp_price' size='8'></td>
<td align='center'><input type=text name='tax$k' value='$temp_tax' size='3'></td>
<td align='center'><input type=text name='quantity$k' value='$temp_quantity' size='3'></td>
<td align='center'><font color='white'><b>$products_quantity</b></font></td>
<td align='center'><font color='white'><b>$cfg_currency_symbol$rowTotal</b></font></td>
<td align='center'><input type='button' name='updateQuantity$k' value='$lang->update' onclick=\"document.add_sale.action='sale_ui.php?update_item=$k';document.add_sale.submit();\"></td>
<input type='hidden' name='item_id$k' value='$temp_item_id'>
</tr>";
}

$finalSubTotal=number_format($finalSubTotal,2,'.', '');
$finalTax=number_format($finalTax,2,'.', '');
$finalTotal=number_format($finalTotal,2,'.', '');


echo '</table>';

echo "<table align='center'><br>
<tr><td align='left'>$lang->saleSubTotal: &nbsp;&nbsp;&nbsp;$cfg_currency_symbol $finalSubTotal</td></tr>
<tr><td align='left'>$lang->tax: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cfg_currency_symbol&nbsp;&nbsp; $finalTax</td></tr>
<tr><td align='left'>$lang->saleTotalCost: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cfg_currency_symbol $finalTotal</td></tr>
</table>";


echo "<br><table border='0' bgcolor='$table_bg'>
<tr>
<td>
<font color='white'>$lang->paidWith:</font>
</td>
<td>
<select name='paid_with'>
<option value='$lang->credit'>$lang->credit</option>
<option value='$lang->cash'>$lang->cash</option>
<option value='$lang->giftCertificate'>$lang->giftCertificate</option>
<option value='$lang->account'>$lang->account</option>

</select></td>
</tr>
<tr>
<td>
<font color='white'>$lang->saleComment:</font>
</td>
<td>
<input type=text name=comment size=25>
</td>
</tr>

</table>
<br>
<input type=hidden name='totalItemsPurchased' value='$totalItemsPurchased'>
<input type=hidden name='totalTax' value='$finalTax'>
<input type=hidden name='finalTotal' value='$finalTotal'>
<input type='submit' value='Afrekenen'></center></form>";
}
?>
De scanner instellen dat ie er een <enter> achter plakt. (Indien mogelijk)
Waarom zou je deze 'controle' eruit halen? Het lijkt me dat dit erin zit zodat je ook de product naam ziet, aangezien er welleens typefoutjes gemaakt wordt (we zijn mensen he ;)). Dan zie je de titel en weet je dus ook dat je het juiste product in handen hebt.

Maar anders kun je idd wat SanThe zegt een enter/return achter je invoer plakken (in de scanner).

Reageren