Jump to content

dfowler

Members
  • Posts

    223
  • Joined

  • Last visited

    Never

Everything posted by dfowler

  1. Thanks for your help so far! I assume this worked as I didn't get any error on the page and it loaded correctly. As I stated before, I have never used session variables before. Now that the information is in there, how do I retrieve it?
  2. No, there will be multiple data. The user will can pick either one or multiple items that they want to look at. It's going to be a shopping cart system. Screen 1 The user picks what they want to look at Screen 2 shows what they picked on screen #1 Screen 3 processes checkout
  3. Hey guys, I'm pulling a bunch of information from a database in a loop. As I pull the information I want to store them in a $_SESSION variable. Here is my code so far: $query = "SELECT * FROM table where id='$k'"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $_SESSION['item_name'] = $row['name']; } The problem is that it is only saving the last item. I'm not sure how to do this correctly as using session variables are rather new to me.
  4. Hey everybody. This is a two part question. I have never actually had to deal with this before, and I have read through several topics about this here. It seems consensus for the best option when dealing with images is to save them on the server, then have the file location in the database. Here is what I am trying to do. Upload A user can create a record that includes a name and a description about themselves then has the option to upload an image. Then when they submit the image is uploaded and kept in a directory while the image location is uploaded (along with the name and description) to a database. (I have the form created right now minus the image part): <form action="addM2.php" method="POST"> <table> <tr> <td>Name: <input type="text" name="name" /></td> </tr> <tr> <td>Description</td> </tr> <tr> <td><textarea name="description"></textarea></td> </tr> <tr> <td><input type="submit" value="Submit" /><input type="reset" value="Clear" /></td> </tr> </table></form> <?php include '../system.php'; $name = $_POST['name']; $description = $_POST['description']; $SQL = "INSERT INTO table set name='$name', description='$description'"; mysql_query($SQL); print "Meal successfully added!"; ?> Display To display everything I want a page where the name (in a checkbox) and a thumbnail of the image are pulled dynamically and displayed. This will give a user the option to pick who they want to hear more about. However, if there are no images it still displays all the names (in checkboxes). Once again, minus the image part I think I can do this. Any help would be greatly appreciated.
  5. Yeah, I just looked and see there is a Javascript and an AJAX board. I think after a couple of responses this would fit more into one of those. How do I move the thread?
  6. That's the problem. I'm not going to know how many rows are in each table. Users are going to be able to add/delete rows from both tables at any time. So I'm hoping to have something automated so that no matter how many rows are in each table it will still work. Combining the tables on load I don't know how this will solve the problem of only displaying records depending on what option the user picks with the drop down list. Here is how I plan on populating the first list: <?php $query = "select * from tablea where active='1'"; $tablea = array(); $result=mysql_query($query); while (($row = mysql_fetch_assoc($result)) !== false) { $tabla[] = $row; } ?> <?php foreach($tabla as $a) { ?><option value="<?php echo $a['id']; ?>"><?php echo $a['name']; ?></option><?php } ?>
  7. That helps with switching with data, but what about loading? I'll get a little more in detail. Here are how the tables are set up Table A [/td] Table B IDID NameName DescriptionDescription ActiveA_ID Active Now let's say that the option I choose in the drop down has an ID of 2, then I want to only populate the rest of the form with data from Table B that has an A_ID of 2.
  8. I figured it would need some Javascript or something else. I'm pretty good with PHP and MySQL, but my Javascript ability is limited. How would I do this?
  9. Hey guys, here is my problem. I have two tables in a database (table A and table B). I'm trying to create a form where values from table A dynamically populate a select list (I can do this). Then depending on what they pick the rest of the form loads up based on values from table B. For example: The user selects "lunch" from the drop down list (populated by table A); then the rest of the form populates with options from table B that correspond to "lunch". I can do this easily by making the form 2 pages, but I am hoping to do it on one page (or at least look like one page). Thanks for any help!
  10. Ok I figured it out, the loop does pull the names correctly. However, I have to change the WHERE value in order for it to work. Thanks!
  11. I tried this and although it doesn't give me any errors. It doesn't seem to be updating the database at all. (I switched 'database' to the actual name of the database).
  12. Yeah it is bizarre. The basic idea is that the user can change the name and description of the meals in the database. I know there is probably a better way to do this, I just can't think of it. (I'm sure it's something simple too)
  13. Hey guys, I am having trouble with a dynamic form. This will allow a customer to edit fields in a database (no matter how many are in the database). Here is my form: <?php include '../../header.php'; $query = "select * from meals where active='1'"; $meals = array(); $result=mysql_query($query); while (($row = mysql_fetch_assoc($result)) !== false) { $meals[] = $row; } ?> <form action="editM2.php" method="POST"> <table> <?php foreach ($meals as $m) { ?><tr> <td valign="top">Name:</td> <td valign="top"><input type="text" name="<?php echo $m['name']; ?>" value="<?php echo $m['name']; ?>" /></td> <td valign="top">Description: </td> <td valign="top"><textarea name="d<?php echo $m['name']; ?>"><?php echo $m['description']; ?></textarea></td> </tr> <?php } ?> <tr> <td><input type="submit" value="Submit" /></td> </tr> </table> </form> <?php include '../../footer.php'; ?> Now here is my big problem....how I do I process these results? Here is what I was attempting, but it doesn't work. I don't know how to get the information from the form. <?php include '../system.php'; $query = "select * from meals where active='1'"; $meals = array(); $result=mysql_query($query); while (($row = mysql_fetch_assoc($result)) !== false) { $meals[] = $row; } foreach ($meals as $m) { $$m['name'] = $_POST['$m['name']']; $d$m['name'] = $_POST['d$m['name']']; } ?>
  14. will this work even if this is from an external javascript document?
  15. Hey guys, I'll get right down to it. Here is the code: function refreshPrice() { var selectedradio; for (i=0;i<document.getElementById('appform').elements.length;i++) { ele = document.getElementById('appform').elements[i]; if (ele.type == 'radio' && ele.name == 'coverage' && ele.checked) { selectedradio = ele; break; } } price = (document.getElementById('equipment').checked ? 225 : 0) + (document.getElementById('technical').checked ? 0 : 0) + (document.getElementById('personal').checked ? 48 : 0) + pricekeys[selectedradio.value]; document.getElementById('totalprice').innerHTML = '$'+price.toString(); } I need the equipment(225), technical(0), and personal(48) to be modified depending on what their value is in a database. Anybody know how to do this?
  16. Hey guys, my friend wants me to create a web page for him that will allow him to view his security cameras from work. He gave me the ip address for the cameras, but I'm not sure how to pull that feed into a web page. Any information would be great.
  17. Hey, I want to send an email using the mail() function but have it look nice. I was hoping to insert an image in the message and was wondering how I do this. Thanks for any help.
  18. Yeah, that is basically what I was looking to do. I didn't know I would need javascript.
  19. typically a completely blank page results from an error int he coding. You either left out something (like a ' or $) or you have something there that shouldn't be. I notice you have a quote after the </form> at the bottom.
  20. Hey, I'm trying to setup a form where certain options are hidden and depend on what your choice is to display the next question. Here is what I have so far. I could really use some help with this. index.php <?php $logo = $_POST['logo']; ?> <!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>Project</title> <style type="text/css"> p.heading { margin:0px; font-size:18px; font-weight:bold; } </style> </head> <body><?php include('info.php'); ?> <form action="results.php" method="post"> <table align="center" width="600" style="margin-top:15px;"> <tr> <td style="border:none; border-bottom:dashed #CCCCCC 1px;"> <p class="heading">Site Type</p> <?php foreach($site_type as $value => $name) { echo '<input type="radio" name="sites" value="'.$value.'">'.$name.'<br />'; } ?> </td> </tr> <tr> <td style="border:none; border-bottom:dashed #CCCCCC 1px;"> <p class="heading">Number of Pages</p> <select name="pages"> <?php foreach($site_pages[0] as $s) { echo '<option value="'.$s.'">'.$s.'</option>'; } ?> </select> </td> </tr> <tr> <td style="border:none; border-bottom:dashed #CCCCCC 1px;"> <p class="heading">Logo</p> <select name="logo"> <?php foreach($logo_choice as $l) { echo '<option value="'.$l.'">'.$l.'</option>'; } ?> </select> <?php if($logo == 'yes') { ?> <select name="concepts"> <?php foreach($logo_con[0] as $c) { echo '<option value="'.$c.'">'.$c.'</option>'; } ?> </select> <?php } ?> </td> </tr> </table> </form> </body> </html> info.php <?php //The type of site the customer wants $site_type = array("Static", "Content Management", "eCommerce", "MySpace", "Entirely Flash"); //The number of pages the customer wants $page_row1 = array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"); //The multiplier for the page they select $page_row2 = array("4","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5"); //The rate for the page they select $page_row3 = array("$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150"); $site_pages = array($page_row1,$page_row2,$page_row3); //Logo Choices $logo_choice = array("yes", "no"); //Logo Concepts $logo_row1 = array("1","2","3"); //Logo Concept Prices $logo_row2 = array("600","950","1300"); $logo_con = array($logo_row1,$logo_row2); ?>
  21. yeah from what I can tell there are a bunch out there. Some appear that you have to add what you want faxed as an attachment to the mail. So that one seems out. Many also seem very expensive. Is there a way to this completely without using 3rd party sources?
  22. Hey guys, I've looked around and can't really find a definitive answer. I have created an order form for a site where when the customer hits 'Submit' it sends the information to an email. I would like to change it so when they hit 'Submit' it sends the information to a fax. Does anybody know if this is possible? If so, how? Most of the responses say use a fax server, or use a 3rd party source. I'm completely confused with this one. Thanks for any help!
  23. I'm working on a restaurants website. I've set it up where a customer can come online and order items off their menu. I have then tried to create an administrator side where they can view these orders. Here is where the problem is. The display currently looks like this: Order ID Contact Info Order Specials/Instructions Date/Time to Fill 41 Test User, test@gmail.com, 9125555555 Fried Fish Submarine with fries Caesar Salad Aug 31,2007 11:45 Looks great, however, the customer ordered more than just a fish submarine. The tables are set up as follows: Orders Order_Items Items ID ID ID Cus_Name Order_ID Item_Name Cus_Phone Item_ID Item_Price Cus_Email Quantity Order_Date Specials Here is the code I am using to display the items: $resource = myQuery("select * from ".ORDERSTABLE." where active='y' and for_date <= NOW() order by for_date"); $nowOrders = array(); while (($row = mysql_fetch_assoc($resource)) !== false) { $nowOrders[] = $row; } $itemid = array(); foreach ($nowOrders as $o) { $resource = myQuery("select * from ".OLINKTABLE." where order_id=".$o['id'].""); while (($row = mysql_fetch_assoc($resource)) !== false) { $itemid[$o['id']] = $row; } } $items = array(); foreach ($itemid as $o) { $resource = myQuery("select * from ".ITEMSTABLE." where id=".$o['item_id'].""); while (($row = mysql_fetch_assoc($resource)) !== false) { $items[$o['order_id']] = $row; } } <?php foreach ($nowOrders as $o) { ?> <td><?php echo $o['id']; ?></td> <td><?php echo $o['name'].', '.$o['email'].', '.$o['phone']; ?></td> <td><?php echo $items[$o['id']]['name']; ?></td> <td><?php echo $o['instructions']; ?></td> <td><?php echo $date = date("M d,Y g:i", strtotime($o['for_date']));; ?></td> <td><input type="checkbox" name="inactive[]" value="<?php echo $o['id']; ?>"/></td> </tr> <?php } ?> Can anybody see what I am doing wrong? I can figure out why it is only displaying one order (even though in the table on the database side it shows multiple items under the Order_ID). I feel like it is something small as I am very close. I hope somebody can help with this.
×
×
  • 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.