Jump to content

staci

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by staci

  1. Ok, so I took everything you guys said to heart. I changed the header image and navigation... not sure if it looks more header-ish, but let me know what you think. I also enlarged the text a bit and centered the page so it shouldn't have the pixels on the right anymore. (I didn't see them in my browser so I'm not sure if it fixed them). BUT that being said, if you guys could take another look and let me know I would appreciate it greatly.
  2. I would like some feedback for my website. I'm kind of new to php and some of the more advanced coding I used... but please give any and all feedback. Thanks! http://www.onlineresale.org/
  3. Ok, nevermind that last post. I found a javascript that allows me to do exactly what I want. But now I have a math question for php. Ok, so my price and quantity fields are stored into their own array. Example would be: Price Array (3, 4, 5, 6) and Quantity Array (1, 2, 3, 4). What I need to have happen here is the first numbers in each array to multiply, then the second, then the third, then the fourth. The results from each need to then add together to get the total. Example: Price Array (3, 4, 5, 6) - Quantity Array (1, 2, 3, 4) So then: 3*1=3, 4*2=8, 5*3=15, 4*6=24. Then 3+8+15+24= 50 So then the total equals 50. How do I do this?
  4. Ok, I kind of understand, but that only serves to clean up my math right? And also to add a count function? But, one of the things I am really after is a way to only show one item form on my page and then allow the user to add an item as they need it. Let me see if I can make this more clear. What the website is: It's like a giant yardsale. If someone has something they want to sell they can come to us and we will post it on our website (or on eBay) for them. It's a safer alternative to Craigslist or other classifieds because they will not need to put their personal information. It also allows them to reach a broader range of buyers because it is online and will allow buyers to pay with more than just cash. So when someone wants to sell something of theirs they can come to the website and use this form to enter in the item they want to sell. I want them to be able to put in up to 10 items and once they submit the form echo a print page with all the information. They can then bring this to me along with their items as a receipt. On my html page I have just one form for 1 Item's information: Item #1, Brand, Model, Price, and Quantity. I want the user to be able to click a button which will dynamically add a second form with item 2's information: Item#2 Brand, Model, Price, and Quantity. Since I charge for every item I post on my website, and give discounts after 5 and 10 items I will need to keep track of how many unique items they are posting. As well, since I would like the form to echo each individual item in a new page, each dynamically created form will need the inputs to be unique.
  5. Ok... this is going to be a hairy explanation and I'll apologize for that before I begin. Ok, so what I have: Not much... I have a simple form, in the first td I have an input box asking for the number of items. In the second td I have four input boxes; brand, model, price, quantity. And in the third td I have a submit button. Once the information is submitted it jumps to a php script that processes the number of items, the pricing, and the quantity and echoes a nice little summary of pricing and fees. Ok, not so complex right? Here's where it gets nasty... I would like another button placed somewhere in the form which will add another item. When it adds the next item, I need all the same information as the first item, but with each input having a unique name (so I can pop item #2's information into their own variables and do some math with item #1's data. Additionally, I would like to have a maximum of 10 items total and for the submit/clear buttons to be moved to the bottom. For better understanding, here is the exact coding I am currently using: Form Code: <table border="0" cellpadding="0" cellspacing="0"> <td> <tr> <form name="individualform" method="post" action="price.php"> </tr></td> <tr> <td> <font size="4">Item #1</font><br> Brand:<br> <input name="brand1" type="int" id="brand1" size="26"><p> Model:<br> <input name="model1" type="int" id="model1" size="26"><p> Price:<br> <input name="price1" type="int" id="price1" size="5"><p> Quantity:<br> <input name="quantity1" type="int" id="quantity1" size="5"><p> </td> </tr> <tr> <td> <input type="submit" name="submit" value="submit" /> <input type="reset" name="submit2" value="reset" /> </tr></td> </table> So an example of the add new item maybe change the values to Item#2, brand2, model2, ect... And here's the php it references: <?php $items =$_POST['items']; $price1 =$_POST['price1']; $quantity1 = $_POST['quantity1']; $price2 =$_POST['price2']; $quantity2 = $_POST['quantity2']; $price3 =$_POST['price3']; $quantity3 = $_POST['quantity3']; $price4 =$_POST['price4']; $quantity4 = $_POST['quantity4']; $price5 =$_POST['price5']; $quantity5 = $_POST['quantity5']; $price6 =$_POST['price6']; $quantity6 = $_POST['quantity6']; $price7 =$_POST['price7']; $quantity7 = $_POST['quantity7']; $price8 =$_POST['price8']; $quantity8 = $_POST['quantity8']; $price9 =$_POST['price9']; $quantity9 = $_POST['quantity9']; $price10 =$_POST['price10']; $quantity10 = $_POST['quantity10']; /*POST PRICE BY NUMBER OF INDIVIDUAL ITEMS*/ if (($items >= 1)&&($items <= 4)){ $posting=.75; }elseif (($items > 4)&&($items < 10)){ $posting=.50; }elseif ($items ==10){ $posting=.25; } /*SETS DISCOUNT FOR POSTING*/ $postprice = $posting * $items; /*REST*/ $totalrequestedprice1 = $price1 * $quantity1; $totalrequestedprice2 = $price2 * $quantity2; $totalrequestedprice3 = $price3 * $quantity3; $totalrequestedprice4 = $price4 * $quantity4; $totalrequestedprice5 = $price5 * $quantity5; $totalrequestedprice6 = $price6 * $quantity6; $totalrequestedprice7 = $price7 * $quantity7; $totalrequestedprice8 = $price8 * $quantity8; $totalrequestedprice9 = $price9 * $quantity9; $totalrequestedprice10 = $price10 * $quantity10; $totalprice = $totalrequestedprice1 + $totalrequestedprice2 + $totalrequestedprice3 + $totalrequestedprice4 + $totalrequestedprice5 + $totalrequestedprice6 + $totalrequestedprice7 + $totalrequestedprice8 + $totalrequestedprice9 + $totalrequestedprice10; $fee = .1; $totalcommission = $totalprice * $fee; $totalprofit =$totalprice - $postprice - $totalcommission; $totalpostfee = money_format("$%i USD", $postprice); $yourtotalprofit = money_format("$%i USD", $totalprofit); $ourcommission = money_format("$%i USD", $totalcommission); $yourtotalprice = money_format("$%i USD", $totalprice); echo "Your profit before fees: $yourtotalprice.<br>Our posting fees: $totalpostfee.<br>Our services commission: $ourcommission.<br>Your total profit: $yourtotalprofit."; ?> Before I get yelled at, let me just say that I am a php nublet. I had visual basic maybe two years ago... so it's kinda similar... I know just enough to get me in trouble. If there is a better way of doing this (one I can understand), please let me know.
  6. It worked flawlessly. You are my hero.
  7. Ok, so here's my problem. I am trying to create a website where I resell various items for people. One way I will be doing this is by posting their items on my website. Since I will be adding new items all the time I thought I would use some php to make it easier. Problem is, I'm very much new to php, though I do have some training with visual basic, kinda similar. ANYWAY, so here's what I have going: I made a form where I can enter various pieces of information about an item. The form then stores each field into it's own variable and then sends them to a mySQL database. After it updates the database it will generate an html page based off of the same variables. My problem is: It creates everything just fine, but none of the variables in the html page show up. I know html cannot read variables, but well, here's my code... <?php $table=$_POST['table']; $host="myhost"; // I changed the name for the forum. $username="myusername"; // Mysql username $password="mypassword"; // Mysql password $db_name="mydatabase"; // Database name $tbl_name="$table"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); //These are the variables I get from my form. $bra=$_POST['brand']; $mod=$_POST['model']; $con=$_POST['condition']; $pri=$_POST['price']; $ims=$_POST['images']; $but=$_POST['button']; $des=$_POST['description']; $url=$_POST['url']; $inc=$_POST['includes']; $qua=$_POST['quantity']; $img=$_POST['image']; //check if query successful $sql="INSERT INTO `electronics` (`id`, `brand`, `model`, `condition`, `price`, `image1`, `button`, `description`, `url`, `includes`, `quantity`, `image2`) VALUES ('', '$bra', '$mod', '$pri', '$con', '$ims', '$but', '$des', '$url', '$inc', '$qua', '$img')"; $result=mysql_query($sql); //If it was successful in updating the database I then want it to generate the html code for the page it will generate. if($result){ $html =' <head> <title>Online Resale</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="header"> <ul id="menu"> </ul> </div> <div id="gutter"></div> <div id="col1"> </div> <div id="col2"> <div align="center"><font size="5"><? echo $bra; ?> </font><br><font size="3">Model: <? echo $mod; ?> </div><p> <table> <tr> <td> <div align="center"> <img src="<?php echo $ims; ?> " width="330"></div></td> <td> <div align="center"> <img src="<?php echo $img; ?> " width="330"></div></tr></td> <tr><td> Quantity: <?php echo "$qua"; ?> <p> Condition: <?php echo $con; ?> <p> Description: <?php echo $des; ?> <p> Included Items: <?php echo $inc; ?> <p> </td> <td><div align="center"><font size="2"><img src="/paypal.jpg" height="150"><br>Cash and Money Orders also available<br> when pick-up is selected.</font><br> <?php echo $but; ?> </div> </td> </tr> </table> <p> <hr>All of our items come with a <a href="../return.html">Return Policy</a>. We guarantee all information is accurate and described to the best of our abilities. If you have any questions please <a href="../contact.html">Contact Us</a>.<p> All items will be shipped next business day. Please expect 3-7 days for delivery.<p> <div align="center"><FORM><INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="history.go(-1)"></FORM> </div></div> <div id="col3"><div align="center"> <?php include (\'../adverts.php\'); ?> </div> </div> <div id="footer"><?php include (\'../footer.php\'); ?> </div> </div> </body> '; //This is where it creates the url I specified in my form. $fh = fopen("$url", "w+"); if($fh==false) die("unable to create file"); //This is where it writes the html code and saves the page. $fp=fopen("$url","w+"); fwrite($fp,$html); fclose($fp); mysql_close(); } else echo "error"; ?> I must again say that it generates everything just fine... my ONLY problem is that the variables I want to show up in the created html page are blank. If I view source for the page it actually shows the <?php $variable; ?> as though it thinks it is an html tag. (which of course doesn't display anything). So, I'm just wondering what I'm doing wrong here... Maybe there is a way to store the variables, maybe change the page to .php? Any help would be greatly appreciated!
×
×
  • 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.