Jump to content

phatgreenbuds

Members
  • Posts

    127
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

phatgreenbuds's Achievements

Member

Member (2/5)

0

Reputation

  1. ahhh I see. I was having trouble understanding what you did here and thats because I included something that was unrelated. Those two hidden fields are something totally different and not related to this. <?php $query = "SELECT * FROM tbl_prods WHERE cat = 'fruit'"; $target = mysql_query($query);confirm_query($target); while($row = mysql_fetch_assoc($target)) { ?> <form action="quoter.php" method="POST"> <tr> <td><input name="sku" type="text" value="<?php echo $row[sku]; ?>" size="20" /></td> <td><textarea name="desc" cols="150" rows="2"><?php echo $row[desc]; ?></textarea></td> <td><input name="price" type="text" value="<?php echo $row[price]; ?>" size="20" /></td> <td><input name="quantity" type="text" value="0" size="3" maxlength="2" /></td> </tr> <?php } ?> </table> <input type="submit" name="submit" value="Submit"></p> </form>
  2. thanks for the quick response...trying this now...
  3. So I am trying to make my life easier at work. I have this idea that I can automate the sales quote via a simple website. I have the entire product list in MySQL and I can query for the individual catagories etc etc and get them to display. The display shows the SKU, Description, Price, and a third field to select quantity. The issue is that once they select a quantity of a paticular line item I need that line item (sku, description, and price fields) to be carried over to the final quote page where the math is done. Not sure how to key the paticular line item fields off the quantity field. Any ideas greatly appreciated... <?php $query = "SELECT * FROM tbl_prods WHERE cat = 'fruit'"; $target = mysql_query($query); confirm_query($target); while($row = mysql_fetch_assoc($target)) { ?> <form action="quoter.php" method="POST"> <tr> <td><input name="sku" type="text" value="<?php echo $row[sku]; ?>" size="20" /></td> <td><textarea name="desc" cols="150" rows="2"><?php echo $row[desc]; ?></textarea></td> <td><input name="price" type="text" value="<?php echo $row[price]; ?>" size="20" /></td> <td><input name="quantity" type="text" value="0" size="3" maxlength="2" /></td> </tr> <?php } ?> </table> <input type="hidden" name="cust" value="<?php echo $cust; ?>"></p> <input type="hidden" name="reg" value="<?php echo $region; ?>"></p> <input type="submit" name="submit" value="Submit"></p> </form>
  4. Ok well I got it sorta working but as you can see below as this branches out it could quickly turn into a huge mess...and I plan to have several branches so I do mean a mess. Looks like I have to try something else perhaps the post above from ignace. <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td> <?php if (isset($_POST['s1'])){ $arr[0] = $_POST['s1']; $i = $_POST['s1']; switch ($i) { case "Red1": echo $arr[0]; break; case "Blue1": echo $arr[0]; break; case "Green1": echo $arr[0]; break; } } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s1" value="Red1" /> Red1 <br /> <input type="radio" name="s1" value="Blue1" /> Blue1 <br /> <input type="radio" name="s1" value="Green1" /> Green1 <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> </form> <?php } ?> </td> </tr> <tr> <td> <?php if ($arr[0] == "Red1") { if (isset($_POST['s2'])){ $arr[1] = $_POST['s2']; $j = $_POST['s2']; switch ($j) { case "Red2Red1": echo $arr[1]; break; case "Blue2Red1": echo $arr[1]; break; case "Green2Red1": echo $arr[1]; break; } } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s2" value="Red2Red1" /> Red2Red1 <br /> <input type="radio" name="s2" value="Blue2Red1" /> Blue2Red1 <br /> <input type="radio" name="s2" value="Green2Red1" /> Green2Red1 <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> <input name="s1" type="hidden" value="<?php echo $arr[0]; ?>" /> </form> <?php } } else if ($arr[0] == "Blue1") { if (isset($_POST['s2'])){ $arr[1] = $_POST['s2']; $j = $_POST['s2']; switch ($j) { case "Red2Blue1": echo $arr[1]; break; case "Blue2Blue1": echo $arr[1]; break; case "Green2Blue1": echo $arr[1]; break; } } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s2" value="Red2Blue1" /> Red2Blue1 <br /> <input type="radio" name="s2" value="Blue2Blue1" /> Blue2Blue1 <br /> <input type="radio" name="s2" value="Green2Blue1" /> Green2Blue1 <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> <input name="s1" type="hidden" value="<?php echo $arr[0]; ?>" /> </form> <?php } } else if ($arr[0] == "Green1") { if (isset($_POST['s2'])){ $arr[1] = $_POST['s2']; $j = $_POST['s2']; switch ($j) { case "Red2Green1": echo $arr[1]; break; case "Blue2Green1": echo $arr[1]; break; case "Green2Green1": echo $arr[1]; break; } } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s2" value="Red2Green1" /> Red2Green1 <br /> <input type="radio" name="s2" value="Blue2Green1" /> Blue2Green1 <br /> <input type="radio" name="s2" value="Green2Green1" /> Green2Green1 <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> <input name="s1" type="hidden" value="<?php echo $arr[0]; ?>" /> </form> <?php } } ?> </td> </tr> <tr> <td> <?php if ($arr[1] == "Red2Red1") { if (isset($_POST['s3'])){ $arr[2] = $_POST['s3']; $k = $_POST['s3']; switch ($k) { case "Red3Red2Red1": echo $arr[2]; break; case "Blue3Red2Red1": echo $arr[2]; break; case "Green3Red2Red1": echo $arr[2]; break; } } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s3" value="Red3Red2Red1" /> Red3Red2Red1 <br /> <input type="radio" name="s3" value="Blue3Red2Red1" /> Blue3Red2Red1 <br /> <input type="radio" name="s3" value="Green3Red2Red1" /> Green3Red2Red1 <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> <input name="s1" type="hidden" value="<?php echo $arr[0]; ?>" /> <input name="s2" type="hidden" value="<?php echo $arr[1]; ?>" /> </form> <?php } } else if ($arr[1] == "Blue2Red1") { if (isset($_POST['s3'])){ $arr[2] = $_POST['s3']; $k = $_POST['s3']; switch ($k) { case "Red3Blue2Red1": echo $arr[2]; break; case "Blue3Blue2Red1": echo $arr[2]; break; case "Green3Blue2Red1": echo $arr[2]; break; } } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s3" value="Red3Blue2Red1" /> Red3Blue2Red1 <br /> <input type="radio" name="s3" value="Blue3Blue2Red1" /> Blue3Blue2Red1 <br /> <input type="radio" name="s3" value="Green3Blue2Red1" /> Green3Blue2Red1 <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> <input name="s1" type="hidden" value="<?php echo $arr[0]; ?>" /> <input name="s2" type="hidden" value="<?php echo $arr[1]; ?>" /> </form> <?php } } else if ($arr[1] == "Green2Red1") { if (isset($_POST['s3'])){ $arr[2] = $_POST['s3']; $k = $_POST['s3']; switch ($k) { case "Red3Green2Red1": echo $arr[2]; break; case "Blue3Green2Red1": echo $arr[2]; break; case "Green3Green2Red1": echo $arr[2]; break; } } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s3" value="Red3Green2Red1" /> Red3Green2Red1 <br /> <input type="radio" name="s3" value="Blue3Green2Red1" /> Blue3Green2Red1 <br /> <input type="radio" name="s3" value="Green3Green2Red1" /> Green3Green2Red1 <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> <input name="s1" type="hidden" value="<?php echo $arr[0]; ?>" /> <input name="s2" type="hidden" value="<?php echo $arr[1]; ?>" /> </form> <?php } } ?> </td> </tr> <tr> <td> <?php print_r ($arr); ?> </td> </tr> </table>
  5. wow ignace, that is soooo far over my head. It will take a while to understand how it works. The reason I went with arrays is that the ultimate goal is to make a searchable page that will dig through the array holding key words assoctiated with a picture...and if any of the selections are found it will return that picture. So yeah i will be using implode and all the good stuff...just writing out the decision making tree can be pretty easy to get yourself lost in.
  6. hmmm I hadn't thought about case/switch. Gonna give that a shot now.
  7. I am going to bed for the night frustrated...I am trying to creating a decision-based branching tree. Based on what you select the first round will determine what is presented in the second round. And all this gets put into an array. This is driving me nuts trying to make sense of it...Maybe I am just tired but here is what I have so far. If anyone out there has a better idea of how to do this I am all about hearing it. <?php if (isset($_POST['s2'])){ $arr = $_POST['s2']; echo $_POST['s1'] . "-" . $arr[0]; } else { if (isset($_POST['s1'])){ if ($_POST['s1'] == "Red"){ echo $_POST['s1']; } else if ($_POST['s1'] == "Blue"){ echo $_POST['s1']; } else if ($_POST['s1'] == "Black"){ echo $_POST['s1']; } else if ($_POST['s1'] == "Yellow"){ echo $_POST['s1']; } else if ($_POST['s1'] == "Green"){ echo $_POST['s1']; ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="checkbox" name="s2[]" value="Red2" /> Red2 <br /> <input type="checkbox" name="s2[]" value="Blue2" /> Blue2 <br /> <input type="checkbox" name="s2[]" value="Black2" /> Black2 <br /> <input type="checkbox" name="s2[]" value="Yellow2" /> Yellow2 <br /> <input type="checkbox" name="s2[]" value="Green2" /> Green2 <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="s1" type="hidden" value="<?php echo $_POST['s1']; ?>" /> </form> <?php } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s1" value="Red" /> Red <br /> <input type="radio" name="s1" value="Blue" /> Blue <br /> <input type="radio" name="s1" value="Black" /> Black <br /> <input type="radio" name="s1" value="Yellow" /> Yellow <br /> <input type="radio" name="s1" value="Green" /> Green <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> </form> <?php } } else { ?> <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="profEdit"> <input type="radio" name="s1" value="Red" /> Red <br /> <input type="radio" name="s1" value="Blue" /> Blue <br /> <input type="radio" name="s1" value="Black" /> Black <br /> <input type="radio" name="s1" value="Yellow" /> Yellow <br /> <input type="radio" name="s1" value="Green" /> Green <br /><br /> <input name="submit" type="submit" value="submit" /> <input name="ident" type="hidden" value="3" /> </form> <?php } } ?>
  8. ahhh gotcha...ok kool this is getting my brain going again...once I finish this part I will begin the searching portion. but for now its the tedious presentation work.
  9. What do you mean here? I assume you mean no strange characters to be used as a seperator in the implode function...or am I missing it?
  10. So the plan is to create a page where people who have uploaded their pic can then create key words to search for them later. For instance if I upload the family photos from thanksgiving I want to be able to include the terms "Turkey, Gravy, Cranberry, etc etc." I assume I have to do this with an array and thats where I start losing my mind. What method should I use to store that array in the DB? Serialize? Implode? There are so many different opinions on google's random page results, I thought best to come here where I have always had success. Step one is to present the options. I plan to use static options in the form of check boxes for now (text fields later). Step two is to store that array in the DB...The reason I am here now. Step three will be to create a means to search that DB for arrays that contain those key words...I am sure I will be back for that. As always I am not looking for the "code handout" but rather the pointer or hints that would help me figure it out myself.
  11. yes I should have been more clear...never even thought to mention it was a template and in my head I was not even thinking that would be what y'all were looking at. So in the future if I should ever use one again I certainly will divulge that. At this point I am still learning PHP, trying to learn Javascript, and maintain my day job. Something had to wait and that was learning Flash...so for peeps like me templates are a huge help. Of course I do hope to one day get to the point that I can do it all my self but for now this is what I got.
  12. Actually that did not work as I am sure you knew it wouldn't but hey this is my process for learning. You gave me a good start and now with some hacking away at it I am sure I will figure it out. Thanks for the help.
  13. ahhhhh so if I were to take it one step further I could change <option value="CA"<?PHP echo ($_GET['state'] == "CA")?" selected=\"selected\"":NULL; ?>>CA</option> to something like this and simplify the whole thing for say 100 different options <option value="CA"<?PHP echo ($_GET['state'] == $_POST['state'])?" selected=\"selected\"":NULL; ?>>CA</option> Or am I still not getting it? Gonna try and see what happens. BTW thanks for the "align" correction...
  14. It is indeed that template, which I paid for and have perfectly legal rights to use EXACTLY as I have. Thanks for the quote nrg_alpha but not needed. jcombs, It turned out that I liked it exactly as it was created versus the others that would have required me to edit and thats why I used it. Add to that I was in a HUGE time crunch to get this completed. Eventually I will make some minor changes but for now to get up and running I see no reason to move that up my list. For now I am merely interested in the flow and functionality of the site itself. Back to nrg_alpha, the fact that you know its a template is far from being ummmm, "owned". Some of us do have a life away from the keyboard so I choose to do things under the mantra of "Work SMARTER not HARDER". Other then the template factor what about the site would need changing.
  15. Please be brutally honest. What needs to change? How would you have done it differently? www.pathwaytofaith.org
×
×
  • 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.