Jump to content

rollerboy

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rollerboy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi I have a shopping cart that displays the products that a customer buys. When a customer buys a product only one is added to the cart. I would like a way of updateing the quantity in the cart. The code for the cart is below. I would be grateful for any suggestions? ps I'm new to php. <?php include ("Products_inc.php"); //call to stylesheet on include file HeaderAndStylesheet(); $query= "SELECT*FROM cart WHERE Username='$Username'"; $result=mysql_query($query); $num=mysql_num_rows($result); if ($num ==0) { echo "The database contains no contacts yet"; } else { echo "<b><centre> Cart</centre></b><br><br>"; //echo "$Full_name"; ?> <table border ="1" cell spaceing= "2" cellpadding= "2"> <tr> <th><font face= "Arial, Helvetica, sans-serif"> order id</font></th> <th><font face= "Arial, Helvetica, sans-serif"> Product Name</font></th> <th><font face= "Arial, Helvetica, sans-serif"> Username</font></th> <th><font face= "Arial, Helvetica, sans-serif"> Product Description</font></th> <th><font face= "Arial, Helvetica, sans-serif"> Price</font></th> <th><font face= "Arial, Helvetica, sans-serif"> Quantity</font></th> <th><font face= "Arial, Helvetica, sans-serif"> Delete</font></th> </tr> <? $i=0; while ($i<$num) { $order_id=mysql_result($result, $i, "order_id"); $Name=mysql_result($result, $i, "Name"); $Username=mysql_result($result, $i, "Username"); $Description=mysql_result($result, $i, "Description"); $Price=mysql_result($result, $i, "Price"); $Quantity=mysql_result($result, $i, "Quantity"); ?> <tr> <td width=100><font face="Arial,Helvetica, sans-serif"><? echo $order_id?></font></td> <td width=100><font face="Arial,Helvetica, sans-serif"><? echo $Name?></font></td> <td width=100><font face="Arial,Helvetica, sans-serif"><? echo $Username?></font></td> <td width=150><font face="Arial,Helvetica, sans-serif"><? echo $Description?></font></td> <td width=100><font face="Arial,Helvetica, sans-serif"><? echo "£$Price"?></font></td> <td><font face="Arial,Helvetica, sans-serif"><? echo $Quantity?></font></td> <td><font face="Arial,Helvetica, sans-serif"> <? echo "<form action=\"delete_from_cart.php\" method=\"post\">"; echo "<input type=\"submit\" value=\"Delete\">"; echo "<input type=\"hidden\" name =\"order_id\" value=$order_id>"; echo "<input type=\"hidden\" name =\"Username\" value=$Username>"; echo "</form>"; ?> </td> </tr> <? $i++; } echo "</table>"; } echo "<form action=\"display_product.php\" method=\"post\">"; echo "<input type=\"submit\" value=\"Continue shopping\">"; echo "<input type=\"hidden\" name =\"Username\" value=$Username>"; echo "<input type=\"hidden\" name =\"Full_name\" value=$Full_name>"; echo "</form><br>"; echo "<form action=\"check_out.php\" method=\"post\">"; echo "<input type=\"submit\" value=\"Go to check out\">"; echo "<input type=\"hidden\" name =\"Username\" value=$Username>"; echo "<input type=\"hidden\" name =\"Full_name\" value=$Full_name>"; echo "</form>"; ?>
  2. Hi,I have a script that validates if a users password is correct. If the password is correct I want to add a button for the user to continue. The script below displays the button if the user is valid or not. When I move the button code to after the line (echo "Welcome back $Username";) I get a parse error. I have also tried to echo out the button like the first 4 lines below but this doesnt work either. Any ideas?? Also what is the simplest way to set a cookie? echo "<form action= "login_display.php" method="post">"; echo "<input type="submit" value="Continue">"; echo "<input type=\"hidden\" name =\"Username\" value=$Username>"; echo "</form>"; //Password Validate <?php include ("customers_inc.php"); $query= "SELECT Password FROM customer_details WHERE Username='$Username'"; $result=mysql_query($query); $num=mysql_num_rows($result); if ($num ==0) { echo "The database contains no contacts yet"; } else { echo "<b><centre> Contacts</centre></b><br><br>"; ?> <? $i=0; while ($i<$num) { $db_Password=mysql_result($result, $i, "Password"); ?> <? $i++; } //60 echo "</table>"; } ?> <? if (($db_Password)===($Password)) { echo "Welcome back $Username"; } else { echo "<b><centre> Invalid user</centre></b><br><br>"; echo "Please try again <a href=\"index2.php\"> Insert details</a><br>"; } ?> <form action= "login_display.php" method="post"> <input type="submit" value="Continue"> <? echo "<input type=\"hidden\" name =\"Username\" value=$Username>"; ?> </form> Thanks in advance for any help
×
×
  • 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.