hi!!m doing my college project on "online digital photo printing"where a customer can upload,edit and order photos at home
the problem i am facing is:-i want to provide my users a "price list of photo type(passport size=rs XXX,stampsize=rs YYY)"
and these prices should be entered by "admin"in a form..that gets updated back to the user as static html page...prices should get apdated in a database....i am using php mysql....what i have to do...please lemme kno..will be waiting..thank you.
Mike_danvers 0 Junior Poster in Training
effu 13 Junior Poster in Training
What is it you are looking for though. Do you have a specific question? What have you tried already?
diafol
I'm assuming that you have to code this from scratch and not use a cms or similar like coppermine (http://coppermine-gallery.net/).
Are users allowed to set their own prices (through an admin page) or are prices set by the admin him/herself (i.e. "the site"/you)?
If you set the prices then you could have a related table...
prices
price_id
photo_type
price_dollars
price_from (date from which price becomes active)
That way all photos are priced automatically. That's just an idea off the top of my head though. I think only few, if any, gallery/image sellers have a single set price for each type of photo. You could make it more flexible by adding "price banding", e.g. A, B, C, D (e.g. relating to quality). Again maybe not so useful.
As effu asks - "What have you tried already" and have you got any code that you can share with us so that we may help you properly.
Mike_danvers 0 Junior Poster in Training
thnx for ur attention
the form i want is smewhat like:-<form>photo type(passport,stamp,poster etc as label["text inputtype"....input box...](for entering respective price of photos)...and two buttons(one for inserting prices..and one for updating the entered prices....
i can now insert successfuly cant update..here is my code..please check and help me out...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<style type="text/css">
header, section, footer, aside, nav, article, figure, figcaption {
display: block;}
body {
color: #666666;
background-color: #f9f8f6;
background-position: center;
font-family: Georgia, times, serif;
line-height: 1.4em;
margin: 0px;}
.wrapper {
width:1111px;
margin: 20px auto 20px auto;
border: 2px solid skyblue;
background-color: #ffffff;}
nav, footer {
clear: both;
color: #ffffff;
background-color: skyblue;
height: 30px;}
nav ul {
margin: 0px;
padding: 5px 0px 5px 30px;}
nav li {
display: inline;
margin-right: 40px;}
nav li a {
color: Green;}
nav li a:hover, nav li a.current {
color: orange;}
section.courses {
float: left;
width: 659px;
border-right: 1px solid #eeeeee;}
article {
clear: both;
overflow: auto;
width: 100%;}
hgroup {
margin-top:40px;}
figure {
float: left;
width: 290px;
height: 220px;
padding: 5px;
margin: 20px;
border: 1px solid #eeeeee;}
figcaption { color: red;
font-size: 100%;
text-align: left;}
aside {
width: 230px;
float: left;
padding: 0px 0px 0px 20px;}
aside section a {
display: block;
padding: 10px;
border-bottom: 1px solid #eeeeee;}
aside section a:hover {
color: blue;
background-color: #efefef;}
a {
color: #de6581;
text-decoration: none;}
h1, h2, h3 {
font-weight: normal;}
h2 { color: Orange;
padding: 0px;}
h3 {
margin: 0px 0px 10px 0px;
color: #de6581;}
aside h2 {
padding: 30px 0px 10px 0px;
color: red;}
footer {
font-size: 80%;
padding: 7px 0px 0px 20px;}
p { color: teal;
font-size: 100%;
}
footer{ text-align: center;
color: black;
font-size: 15px;}
b{text-align: center;}
input#submit {
color: brown;
text-shadow: 2px 1px 1px #ffffff;
border-bottom: 5px solid #b2b2b2;
background-color: #b9e4e3;
background: -webkit-gradient(linear, left top,
left bottom, from(#beeae9), to(#a8cfce));
background:
-moz-linear-gradient(top, #beeae9, #a8cfce);
background:
-o-linear-gradient(top, #beeae9, #a8cfce);
background:
-ms-linear-gradient(top, #beeae9, #a8cfce);}
input#submit:hover {
color: green;
border: 2px solid orange;
border-top: 2px solid #b2b2b2;
background-color: #a0dbc4;
background: -webkit-gradient(linear, left top,
left bottom, from(#a8cfce), to(#beeae9));
background:
-moz-linear-gradient(top, #a8cfce, #beeae9);
background:
-o-linear-gradient(top, #a8cfce, #beeae9);
background:
-ms-linear-gradient(top, #a8cfce, #beeae9);}
input#text {
color: brown;
text-shadow: 2px 1px 1px #ffffff;
border: 10px solid #b2b2b2;
background-color: #b9e4e3;
background: -webkit-gradient(linear, left top,
left bottom, from(#beeae9), to(#a8cfce));
background:
-moz-linear-gradient(top, #beeae9, #a8cfce);
background:
-o-linear-gradient(top, #beeae9, #a8cfce);
background:
-ms-linear-gradient(top, #beeae9, #a8cfce);}
input#text:hover {
color: green;
border: 2px solid orange;
border-top: 2px solid #b2b2b2;
background-color: #a0dbc4;
background: -webkit-gradient(linear, left top,
left bottom, from(#a8cfce), to(#beeae9));
background:
-moz-linear-gradient(top, #a8cfce, #beeae9);
background:
-o-linear-gradient(top, #a8cfce, #beeae9);
background:
-ms-linear-gradient(top, #a8cfce, #beeae9);}
div {
margin: 3px;
padding-bottom: 20px;
width: 260px;}
.title {
float: left;
width: 100px;
text-align: left;
padding-right: 0px;}
.submit {
text-align: right;}
label { color: blue;}
h1 { color: Green;
font-family: "Monotype Corsiva";
font-size: 80px;}
h5{ color: green;
font-size: 30px;
text-position: bottom center;}
fieldset { border: 2px solid teal;}
legend{ color: red;
}
aside section.register{
width: 100px;
}
img:hover {border: 2px solid skyblue;
}
table{ color: black;}
</style>
<head>
<title>Insert/Update Prices</title>
</head>
<h1 align="center">Insert Items or update prices </h2>
<body>
<table border="1" bgcolor="#00FF00" width="1000" align="center" >
<tr>
<td align="center">Insert/Update Prices</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="input.php">
<tr>
<td>Photo-Type</td>
<td><input type="text" name="type" size="20">
</td>
</tr>
<tr>
<td>Price</td>
<td><input type="text" name="price" size="10">
</td>
</tr>
<tr>
<td></td>
<td align="right"><input type="submit"
name="submit" value="Sent"></td>
<td align="right"><input type="submit"
name="submit1" value="update"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
diafol
Well, it started getting interesting at line 230. Why did you include all that css? No need - just gets in the way.
Also, do not use tables for layout.
You have not 'closed the form with a </form>
tag as far as I can see.
You have 2 fields: photo-type and price.
I don't see how this can work. UNLESS all photos of a certain type have a specific price.
What's the php code in the input.php page?
Mike_danvers 0 Junior Poster in Training
<?php
//the example of inserting data with variable from HTML form
//input.php
mysql_connect("localhost","root","");//database connection
mysql_select_db("rate chart");
$type='type';
$price='price';
//inserting data order
$order = "INSERT INTO prices
(type,price)
VALUES
('$_POST[$type]',
'$_POST[$price]')";
//declare in the order variable
$result = mysql_query($order); //order executes
if($result){
echo("<br>Input data is succeed");
} else{
echo("<br>Input data is fail");
}
echo"<br>";
echo "$_POST[$type]";
echo "<br>";
echo "$_POST[$price]";
?>
Mike_danvers 0 Junior Poster in Training
<body>
<div class="wrapper"><h1 align="center">Now Choose Your Own Photo type!!</h1>
<fieldset align="center"><legend>PRICE LIST FOR PHOTO GRAPHS</LEGEND>
<?php
//the example of inserting data with variable from HTML form
//input.php
mysql_connect("localhost","root","");//database connection
mysql_select_db("rate chart");
$type='type';
$price='price';
//inserting data order
$order = "select * from prices";
//declare in the order variable
$result = mysql_query($order); //order executes
while($row = mysql_fetch_array($result)) {
// Write the value of the column FirstName (which is now in the array $row)
echo $row['type'] ."<br/>";
echo "Rs".$row['price']."/"."pc" . "<br/>";
}
// Close the database connection
mysql_close();
?></fieldset></div></html>
Mike_danvers 0 Junior Poster in Training
@diafol...bro thnx fo ur feedback..just check out ma coding...i now can successfully insert prices and phototypes...but i want to update it as well with the help of a update button on the same form as mentioned above....i wud apreciate if u just edit ma code...n make it worth updating...(waiting for ur rply)
diafol
To create a 2-in-1 form you'll probably need to have some sort of url identifier to decide on update or insert.
e.g. www.example.com/gallery/{user}/{image_id}/update/ [for update] or www.example.com/gallery/{user}/ [for insert]
//default values for form (insert)
$field1 = '';
$field2 = '';
$field3 = '';
$field4 = '';
$field5 = '';
$action = 'insert';
You can use mod_rewriting to get the 'GET' value
if(isset($_GET['action']) && $_GET['action'] == 'update')
{
//get image data from image_id in url from $_GET['image_id']
$field1 = '...from DB...';
$field2 = '...from DB...';
$field3 = '...from DB...';
$field4 = '...from DB...';
$field5 = '...from DB...';
$action = 'update';
}
The HTML:
<form ...>
<input name="..." value="<?php echo $field1;?>" />
<input name="..." value="<?php echo $field2;?>" />
<input name="..." value="<?php echo $field3;?>" />
<input name="..." value="<?php echo $field4;?>" />
<input name="..." value="<?php echo $field5;?>" />
<input type="hidden" name="..." value="<?php echo $action;?>" />
<input name="..." type="submit" value="<?php echo strtoupper($action);?>" />
</form>
Top of my head stuff - not thoroughly thought out yet.
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.