-
Posts
780 -
Joined
-
Last visited
Posts posted by mikebyrne
-
-
I know that the following code is used to prevent SQL Injections but what exactly does the trim do? Does it remove the spaces before and after the variable?
$name = mysql_real_escape_string(trim($_POST['name']));
-
Thanks again!
-
In the below code I'm just wondering why we use the Isset?
<?PHP if (isset($_SESSION['usertype']) && $_SESSION['usertype'] == 2) { echo "You're logged in"; } else { echo "You're not logged in"; } ?>
-
I have a navigation tool on my page that says "CD'S UNDER £7" and from this link i want to goto a page called CD7 which will list all cd's under £7
two problems: I'm not 100% sure of the SQL below and how to make my link point to CD7.php
The static link is currently
<a href="http://www.cdwow.ie/feature.php?list_id=685" style="color:#FF9900"> CDs under €7!</a>
Should that be
<a href="CD7.php" style="color:#FF9900"> CDs under €7!</a>
CD7
<?php include("adminconnect.php"); $id = $_GET['id']; $sql = "SELECT * FROM product WHERE Price <= '7'"; $res = mysql_query($sql) or die(mysql_error()); // Since you are getting only one row no neew to loop $row = mysql_fetch_assoc($res); // now just echo all your fields below and format it the way you like echo "Title: ".$row['ProductName']."</a>\n<br> <img src=\"".$row['Image']."\"></img>\n<br> Price ".$row['Price']."\n<br> Description: ".$row['Description']."\n<br>"; ?>
-
Im displaying my product info on this page but I want to add an "Add to Cart" button. The static code for the button is
<a href="cart.php?action=add&id=22"><img src="Pictures/cdw_tdev_atc_v1_red.gif" class="cartimg" border="0" title="WESTLIFE - Love Album, The - Add to cart!" alt="WESTLIFE - Love Album, The - Add to cart!" height="16" width="60"></a>
How can i aply this with use of the varibles below?
<?php include("adminconnect.php"); $id = $_GET['id']; $sql = "SELECT * FROM product WHERE ProductNo = '$id'"; $res = mysql_query($sql) or die(mysql_error()); // Since you are getting only one row no neew to loop $row = mysql_fetch_assoc($res); // now just echo all your fields below and format it the way you like echo "Title: ".$row['ProductName']."</a>\n<br> <img src=\"".$row['Image']."\"></img>\n<br> Price ".$row['Price']."\n<br> Description: ".$row['Description']."\n<br>"; ?>
-
Thanks
<br><br> sloved my problem
-
At present my products are listed one after the other with the code below. How can I make sure the next product starts on a new line??
The last vaible to be displayed for each product is Price
<?php if (isset($_POST['searchme'])) { include("adminconnect.php"); $tbl_name = "product"; $cat = mysql_real_escape_string($_POST['cat']); $input =mysql_real_escape_string($_POST['searchfield']); $query = "SELECT * FROM product WHERE Producttype = '$cat' AND Productname LIKE '%$input%'"; $result = mysql_query($query) or die ("error in the query" . mysql_error()); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result)) { echo "Title <a href=\"product.php?id=".$row['ProductNo']."\">".$row['ProductName']."\n<br> Price ".$row['Price'].""; } } else { echo "No search results found"; } } else { echo "No search terms entered."; } ?>
-
Ok thanks for your help.
One last thing, how would I apply the code to the "purchase" button I'm not to familair with calling functions?
A purchase button: '<div><button type="submit">Purchase</button></div>';
<form action="cart.php?action=purchase" method="post">
<input type="submit" name="purchase" value="Purchase" />
</form>
-
Yeah i'm a little confused with item 14?
The primary key is the ProductNo would you be better using that in the reduction?
-
No problem.
It not going live its just a project im doing there forefore I dont need the actual payment info etc
I just really want the database updated ie stock reduced when the created "Purchase" button is clicked
-
Any help here would be great
-
I want to add a purchase button to my cart. I've a rough idea of what I need to put into the fucntion below but im really not sure how to structure it
I know I need to insert
SQL2= UPDATE $table SET stockamount = stockamount - 1 WHERE ProductNo = $id
A purchase button: '<div><button type="submit">Purchase</button></div>';
A Form
<form action="cart.php?action=purchase" method="post">
<input type="submit" name="purchase" value="Purchase" />
</form>
Any help here would be great
<?php function writeShoppingCart() { $cart = $_SESSION['cart']; if (!$cart) { return '<p>You have no items in your shopping cart</p>'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; return '<p>You have <a href="cart.php">'.count($items).' item'.$s.' in your shopping cart</a></p>'; } } function showCart() { global $db; $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM product WHERE ProductNo = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$ProductName.' by '.$Productinfo.'</td>'; $output[] = '<td>€'.$Price.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>€'.($Price * $qty).'</td>'; $total += $Price * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>€'.$total.'</strong></p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output); } ?>
-
I'll be near my laptop in an hour or so, thanks for your help.
A couple of quick questions:
1) Is the chmod("$add",0776); needed as im using windows?
2) What does the below statement do?
$img= implode(",",$fileName);
$imag=explode(",",$img);
-
Thats great!
I only need one button on the page to submit all the info
-
The query works its the setting up of the button on the form i cant get right
-
I'll probably get rid of the submit button (dont like the look of it) and code around the below button
<div id="btn"> <input type=hidden name=action value="Add"> <input type="submit" name="Submit" value="" style="border:0;background:url(../Admin_files/btn_update.gif) no-repeat;width:73px;height:23px;"> <div id="btnSpace"> <!-- --> </div>
How would I adjust the validation to allow for this??
-
Would I be better off getting rid of the "Submit" button and putting the validation
if($_POST["submit"]=='Upload File') { while(list($key,$value) = each($_FILES['uploadedfile']['name'])) { if(!empty($value)) { $filename = $value; $add = "Pictures/".$filename; //echo $add; copy($_FILES['uploadedfile']['tmp_name'][$key], $add); chmod("$add",0776); } } $fileName = $_FILES['uploadedfile']['name']; //$a[] = $fileName; $img= implode(",",$fileName); $imag=explode(",",$img); //echo $imag[0]; //print_r($image[0]); //$Image1= $image[0]; //echo $image[0]; //$Image2= $image[1]; // Where the file is going to be placed //$target_path = "Pictures/".$_FILES['uploadedfile']['name']; //echo $target_path; // ///* Add the original filename to our target path. //Result is "uploads/filename.extension" */ //$_FILES['uploadedfile']['tmp_name']; // // //if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { // echo "The file ". basename( $_FILES['uploadedfile']['name']). // " has been uploaded"; //} else{ // echo "There was an error uploading the file, please try again!"; //}
Under the
if($_POST["action"] == "Add"){
-
Ah think im onto the problem now. The validation works when the user hits the Upload button under image2 but not with my desired button
located
<div id="btn"> <input type=hidden name=action value="Add"> <input type="submit" name="Submit" value="" style="border:0;background:url(../Admin_files/btn_update.gif) no-repeat;width:73px;height:23px;"> <div id="btnSpace"> <!-- --> </div>
-
My form validation is now suddenly decided to stop working and I cant see why??
If i leavd every field blank I get no error reporting at all
My code is:
<?PHP require_once("adminconnect.php"); $con=mysql_connect("localhost","root",""); mysql_select_db("test",$con); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $Display = strtoupper($_POST['display']); $Image = $_POST['Image']; $Image2 = $_POST['Image2']; if($_POST["submit"]=='Upload File') { while(list($key,$value) = each($_FILES['uploadedfile']['name'])) { if(!empty($value)) { $filename = $value; $add = "Pictures/".$filename; //echo $add; copy($_FILES['uploadedfile']['tmp_name'][$key], $add); chmod("$add",0776); } } $fileName = $_FILES['uploadedfile']['name']; //$a[] = $fileName; $img= implode(",",$fileName); $imag=explode(",",$img); //echo $imag[0]; //print_r($image[0]); //$Image1= $image[0]; //echo $image[0]; //$Image2= $image[1]; // Where the file is going to be placed //$target_path = "Pictures/".$_FILES['uploadedfile']['name']; //echo $target_path; // ///* Add the original filename to our target path. //Result is "uploads/filename.extension" */ //$_FILES['uploadedfile']['tmp_name']; // // //if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { // echo "The file ". basename( $_FILES['uploadedfile']['name']). // " has been uploaded"; //} else{ // echo "There was an error uploading the file, please try again!"; //} if($_POST["action"] == "Add"){ $valid=1; if($_FILES['uploadedfile']['name'][0]=="" && $_FILES['uploadedfile']['name'][1]=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_image = "Please UPLOAD A FILE"; } if ($_FILES['uploadedfile1']['error'] != 0) { $valid=0; $style_name = "background-color:#FF5959"; $error_image = "Please UPLOAD A FILE"; } if ($_POST['Type'] =="") { $valid=0; $style_name = "background-color:#FF5959"; $error_type = "Please enter the product type"; } if ($_POST['ProductName']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "The Product Name seems to be mising?"; } if ($_POST['Description']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_description = "Your description seems to be mising?"; } if ($_POST['Stockamount']=="") { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter the ammount of stock recivied"; } if(empty($_POST['Price'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_price = "Please enter the price"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Price']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_price = 'Price is invalid. Numbers only (eg: 123.05)'; } if(empty($_POST['Stockamount'])) { $valid=0; $style_name = "background-color:#FF5959"; $error_amount = "Please enter a stock ammount"; } if(preg_match("/\A[0-9]{1,16}(\.[0-9]{2}){0,1}$/",$_POST['Stockamount']) != 1) { $valid = 0; $style_name = "background-color:#FF5959"; $error_amount = 'Ammonut is invalid. Numbers only (eg: 1,2,3)'; } if ($valid==1) { $sql="INSERT INTO $tbl_name (Producttype, ProductName,Stockamount,Display, Description,Price, Image, Image2) VALUES ('$Type','$ProductName','$Stockamount','$Display' ,'$Description', '$Price', '$imag[0]', '$imag[1]')"; echo $_POST['Type']; echo $_POST['ProductName']; echo $_POST['Stockamount']; echo $_POST['Display']; echo $_POST['Description']; echo $_POST['Price']; echo $_POST['Image']; echo $_POST['Image2']; echo $sql; $result=mysql_query($sql)or die(mysql_error()."<p>With Query $sql"); } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../includes/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></div> <div id="contentBox"> <form action="add.php" onsubmit="return valid()" enctype="multipart/form-data"method="post"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/start.php" class="black">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/postage.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/adminreg.php" class="black">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/add.php" class="black_on">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <!-- --> <!-- Double Space undernath CD --> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">EDIT ITEM</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="290" align="left">IMAGE</td> <td width="527">DETAIL</td> </tr> </table> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop1"> <!-- data Left start --> <div class="editLeft"> <!-- picture1 start --> <div class="editLeftBox">PICTURE 1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile[]" id="uploadedfile[]" type="file" /> <!--<input type="submit" name="submit" value="Upload File" />--><?php echo $error_image; ?> <div class="editLeftBox"> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish --> <div class="padTop50"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- picture2 start --> <div class="editLeftBox">PICTURE 2:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile[]" id="uploadedfile[]" type="file" /> <input type="submit"name="submit" value="Upload File" /><?php echo $error_image; ?> </div> <div class="clr"> <!-- --> </div> <!-- picture2 finish --> </div> <!-- data Left finish --> <!-- data Right start --> <div class="editRight"> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Type:</div> <div class="editRightForm"> <select name="Type" class="000"> <option value="">------</option> returns $_POST['Type'] = "" <option value="Game" >GAME</option> returns $_POST['Type'] = "Game" <option value="DVD" >DVD</option> returns $_POST['Type'] = "DVD" <option value="CD" >CD</option> returns $_POST['Type'] = "CD" </select> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_type; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Name:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="ProductName" value="<?php $row['ProductName'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_name; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Description:</div> <div class="editRightForm"> <textarea type="text" class="itemEditForm03" name="Description" ><?php echo $row['Description'];?></textarea> <font color="#FF0000" style="font-size: 8pt"><?php echo $error_description; ?></font> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Stock Rec'd:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="Stockamount" value="<?php $row['Stockamount'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_amount; ?></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Price:</div> <div class="editRightForm"> <div class="editItemPrice1">€</div> <div class="editItemPrice2"> <input type="text" class="itemEditForm04" name="Price" value="<?php $row['Price'];?>" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_price; ?></font></td> </div> <div class="clr"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> </div> <div class="editRadio4">hide</div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop75"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <!-- data Right finish --> </div> <div class="clr"> <!-- --> </div> <div class="padTop11"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dottedIn"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <!-- btn start --> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="btn"> <input type=hidden name=action value="Add"> <input type="submit" name="Submit" value="" style="border:0;background:url(../Admin_files/btn_update.gif) no-repeat;width:73px;height:23px;"> <div id="btnSpace"> <!-- --> </div> <input type="reset" value="" style="border:0;background:url(../Admin_files/btn_clear.gif) no-repeat;width:73px;height:23px;" onclick="return confirm('Are you sure you want to clear all data?')"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </div> </body> </html>
-
LOL
This piece of code will be the death of me. The validation isnt working now!
Going to post a new topic. Cant see why its not working
-
Sorry, problem found. I copied and pasted from the forum and of course the closing <a href> tags (</a>)'s have been replaced with the forum's own closing link tag ([/url]).
DONT COPY AND PASTE FROM FORUM, lesson learnt!
-
Hi ben
yeah if i just click the form it refreshes. must be script aound the upload button??
-
I caught a bad case of divitis!!
Any idea as to the problem??
-
Output source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../includes/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></div> <div id="contentBox"> <form action="add.php" onsubmit="return valid()" enctype="multipart/form-data"method="post"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/start.php" class="black">Order[/url]</div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Sales[/url]</div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/list.php" class="black">Edit item[/url]</div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/postage.php" class="black">Postage fee[/url]</div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/adminreg.php" class="black">Add User[/url]</div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/add.php" class="black_on">Add Product[/url]</div> <div id="menu_space1"><!-- --></div> </div> <!-- --> <!-- Double Space undernath CD --> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">EDIT ITEM</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="290" align="left">IMAGE</td> <td width="527">DETAIL</td> </tr> </table> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop1"> <!-- data Left start --> <div class="editLeft"> <!-- picture1 start --> <div class="editLeftBox">PICTURE 1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile[]" id="uploadedfile[]" type="file" /> <!--<input type="submit" name="submit" value="Upload File" />--> <div class="editLeftBox"> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish --> <div class="padTop50"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- picture2 start --> <div class="editLeftBox">PICTURE 2:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="Pictures/No_image.png" alt="pic1" width="150" height="200" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile[]" id="uploadedfile[]" type="file" /> <input type="submit"name="submit" value="Upload File" /> </div> <div class="clr"> <!-- --> </div> <!-- picture2 finish --> </div> <!-- data Left finish --> <!-- data Right start --> <div class="editRight"> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Type:</div> <div class="editRightForm"> <select name="Type" class="000"> <option value="">------</option> returns $_POST['Type'] = "" <option value="Game" >GAME</option> returns $_POST['Type'] = "Game" <option value="DVD" >DVD</option> returns $_POST['Type'] = "DVD" <option value="CD" >CD</option> returns $_POST['Type'] = "CD" </select> <td width="269"><font color="#FF0000" style="font-size: 8pt"></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Name:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="ProductName" value="" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Description:</div> <div class="editRightForm"> <textarea type="text" class="itemEditForm03" name="Description" ></textarea> <font color="#FF0000" style="font-size: 8pt"></font> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Stock Rec'd:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="Stockamount" value="" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"></font></td> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Price:</div> <div class="editRightForm"> <div class="editItemPrice1">€</div> <div class="editItemPrice2"> <input type="text" class="itemEditForm04" name="Price" value="" /> <td width="269"><font color="#FF0000" style="font-size: 8pt"></font></td> </div> <div class="clr"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> </div> <div class="editRadio4">hide</div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop75"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <!-- data Right finish --> </div> <div class="clr"> <!-- --> </div> <div class="padTop11"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dottedIn"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <!-- btn start --> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="btn"> <input type=hidden name=action value="Add"> <input type="submit" name="Submit" value="" style="border:0;background:url(../Admin_files/btn_update.gif) no-repeat;width:73px;height:23px;"> <div id="btnSpace"> <!-- --> </div> <input type="reset" value="" style="border:0;background:url(../Admin_files/btn_clear.gif) no-repeat;width:73px;height:23px;" onclick="return confirm('Are you sure you want to clear all data?')"> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </div> </body> </html>
[SOLVED] Mysql dropdown option in field
in MySQL Help
Posted
I am currently setting up a database and in one of the fields i want the user to only input one of 5 options (-,D,E,L,S) How do i format the field to allow these options in a drop down box?
The field name is Vote with Varchar of length 5