0

will somebody show me a sample how to add cart using dynamic button??

im having trouble retrieving value using dynamic button


using the code below

#
echo("<TR id='$i' bgcolor='B0C4DE'>");
#
$sr_num=$row['b_sr_num'];
#
echo ("<td><input name=data id=data type=text id=data readonly=readonly value=$sr_num></td>");
#
echo ('<td>'.$row['b_name'].'</td>');
#
echo ('<td>'.$row['b_author'].'</td>');
#
echo ('<td>'.$row['b_avail'].'</td>');
#
 
#
if($row['b_avail']>0)
#
{
#
if (!$_SESSION["valid_user"])
#
{
#
// User not logged in, redirect to login page
#
echo("<td>Available</td>");
#
}else
#
echo("<td><INPUT TYPE=button id=show name=show value=add onClick= buttonPress('$sr_num')></td>");
#
 
#
}else
#
echo("<td>No stock of book</td>");
#
echo("</TR>");
#
$i=$i+1; }
#
echo("</TABLE>");

should i use php or ajax?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by HemantPHP
0

Hey,

On which process page you try to implement dynamic button? Why? I think you try to same on any product listing page for clicking on button that product will add into current cart session, If yes than you can achieve same with using php/ajax and creating new table like cart_master. And clicking on that button you have write code to that product id goes into cart_master table along with userid.

I hope this will help you!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.