Jump to content

richrock

Members
  • Posts

    213
  • Joined

  • Last visited

Everything posted by richrock

  1. Hi, I tried it, and it still reorders starting at 0. I also changed $real_lot to $row[lot_order] as seen below, but still no juice. Was up till about 4am last night trying options on this.... $number = mysql_num_rows($result); for($x=0; $x < $number; $x++){ $row = mysql_fetch_array($result); $real_lot = $row['lot_order']; $real_id = $row['id']; $list .= "<li id=\"item_$row[id]\" class=\"catalogue_rows\" >"; $list .= "<table border='0'><tr>"; $list .= "<td width='50'>$row[lot_order]</td>"; $list .= "<td width='400'><strong>$row[title]</strong></td>"; $list .= "<td width='100'>£$row[est_low] - $row[est_high]</td>"; $list .= "<td width='150'>$row[firstname] $row[lastname]</td>"; $list .= "<td>$row[lotrecnum] - $row[reclinenum]</td>"; $list .= "</tr></table>"; $list .= "<input type='hidden' name='lot_order[]' value='$x' />"; $list .= "</li>\n"; }
  2. Hi, I've been using a scriptaculous library to process a list of items, and assign the list to an order. This means that items added to a DB are given an item order that is not defined by item id. However, I have a small problem. The array starts the ordering as 0, and I need it to start at 1. Any ideas how I can do this? This is how the items are listed: $number = mysql_num_rows($result); for($x=1;$x<=$number;$x++){ $row = mysql_fetch_array($result); $real_lot = $row['lot_order']; $real_id = $row['id']; $list .= "<li id=\"item_$row[id]\" class=\"catalogue_rows\" >"; $list .= "<table border='0'><tr>"; $list .= "<td width='50'>$real_lot</td>"; $list .= "<td width='400'><strong>$row[title]</strong></td>"; $list .= "<td width='100'>£$row[est_low] - $row[est_high]</td>"; $list .= "<td width='150'>$row[firstname] $row[lastname]</td>"; $list .= "<td>$row[lotrecnum] - $row[reclinenum]</td>"; $list .= "</tr></table>"; $list .= "<input type='hidden' name='lot_order[]' value='$x' />"; $list .= "</li>\n"; And storing the items via ajax : foreach ($_POST[sortlist] as $varname => $varvalue) { $sql = "update jos_bid_auctions set lot_order = ".mysql_real_escape_string($varname)." where id = ".mysql_real_escape_string($varvalue); $result = mysql_query($sql) or die(mysql_error()); }
  3. I've got a bit of a head scratcher (for me anyway) - I've set up a table to store all the variable rates and charges, as shown in the describe below: +-------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | vat | int(11) | NO | | NULL | | | vat_date | date | NO | | NULL | | | export | int(11) | NO | | NULL | | | export_date | date | NO | | NULL | | | visa | int(11) | NO | | NULL | | | visa_date | date | NO | | NULL | | | amex | int(11) | NO | | NULL | | | amex_date | date | NO | | NULL | | | photo | int(11) | NO | | NULL | | | photo_date | date | NO | | NULL | | | illust | int(11) | NO | | NULL | | | illust_date | date | NO | | NULL | | +-------------+---------+------+-----+---------+----------------+ 13 rows in set (0.00 sec) And in each product item there is a 'modified' field, which records when it was bought, using DATETIME. Here's a sample output for the VAT: +----+-------+------------+ | id | vat | vat_date | +----+-------+------------+ | 1 | 17.50 | 2008-01-01 | | 2 | 17.50 | 2009-01-01 | | 8 | 15.00 | 2009-01-13 | +----+-------+------------+ 3 rows in set (0.00 sec) I can extract dates from the product, no probs. How would I compare the dates in the VAT range, if for example, the item was bought on 2008-09-01, which would fall between id 1 & 2, and then select the latest value? Please help, this is a bit over my head. Also not sure if this is a PHP thing (would be nice), or a MySQL query problem...
  4. Am I doing this right? (Obviously not, but I need to know if I'm heading in the right direction...) ??? I set up a mysql table : +-------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | vat | int(11) | NO | | NULL | | | vat_date | date | NO | | NULL | | | export | int(11) | NO | | NULL | | | export_date | date | NO | | NULL | | | visa | int(11) | NO | | NULL | | | visa_date | date | NO | | NULL | | | amex | int(11) | NO | | NULL | | | amex_date | date | NO | | NULL | | | photo | int(11) | NO | | NULL | | | photo_date | date | NO | | NULL | | | illust | int(11) | NO | | NULL | | | illust_date | date | NO | | NULL | | +-------------+---------+------+-----+---------+----------------+ 13 rows in set (0.00 sec) So I can set up variables for tax rates, fixed charges, and store the date with each so that any invoices/statements for accounts can be calculated against dates they were generated... That's for another day However, when I inserted some test data via phpmyadmin, it rounded up 17.5 to 18 for the VAT, and 2.5 to 3 for the visa rows. I'm not sure how to fix this, so any help would be greatly appreciated. Also, I just copied the INT(11) from other tables but research shows that I could use other values, so could I lower the INT value? I don't mind re-doing the table, but need to keep dates on each numerical value independently. TIA Rich
  5. Hi, Just finished coding a site, and noticed that on the contact form, Safari makes it run off the edge of the <div>, yet every other browser doesn't... ??? Here's the <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="79" align="left" valign="top">Your name</td> <td><input name="your_name" type="text" class="form-box" id="name" size="34" /></td> </tr> <tr> <td width="79" align="left" valign="top">Email address</td> <td><input name="email_address" type="text" class="form-box" id="email_address" size="34" /></td> </tr> <tr> <td width="79" align="left" valign="top">Telephone</td> <td><input name="telephone" type="text" class="form-box2" id="phone_number" size="34" /></td> </tr> </table> [code] and some screengrabs: [attachment deleted by admin]
  6. Yeah there is a place in the formmail script - it just refers the POST data in this case, the hidden referrer as the email address. I'm looking at a way of stopping this email address being either a: visible in the source code, or b: using a code which can be used to refer to the email address on the server... hang on, I think that may be it. I think I'll mark this solved, I'll just need a while to knock up a php script to convert a garbage hidden input into an email address, without it appearing in the source code. Thanks!
  7. Hi all, Although this is about formmail (the script), it's really about the implementation of a particular piece of code relating to it. In the form, I have this: <input type="hidden" name="recipient" value="emailaddress@domain.com" /> which defines who receives the forms posted to formmail. This is fine, but the presence of a complete email address has caused a sharp rise in spam being received So, for most "<a href="mailto...."'s I use this little piece of javascript: <script language="JavaScript" type="text/javascript"> <!-- var name = "emailaddress"; var domain = "domain.com"; document.write('<a href=\"mailto:' + name + '@' + domain + '?subject=Enquiries\">'); document.write(name + '@' + domain + '</a>'); // --> </script> And generally it works. But even with my html experience, I'm probably being a complete dummy and can't figure how to merge the two together. I guess I'm looking for something like: <input type="hidden" name="recipient" value="<script language="JavaScript" type="text/javascript"> <!-- var name = "emailaddress"; var domain = "domain.com"; document.write('<a href=\"mailto:' + name + '@' + domain + '?subject=Enquiries\">'); document.write(name + '@' + domain + '</a>'); // --> </script>" /> But it doens't work... Any ideas, or alternatives to hiding email addresses? TIA Rich
  8. I've been using Netbeans for the last few months, the 6.5 version. You'll need a fairly ninja PC to have it running quick though, and I'm overdue an upgrade at work. It's good for PHP, HTML, CSS and lots more. I'm using it as I intend to expand my skills in other languages, and downloaded the version with *EVERYTHING*. Takes an age to load, only had one crash too.
  9. Help - I think ??? I've written a while loop to search through clients to find who has been assigned 'Paddles' (auctions), but can't seem to order those results. The tables are quite complex (for me) as they reference different bits of information in order to filter it down. Here's what I've done: // Now the in-house bidders $getPADBID = "SELECT * FROM jos_bid_paddles"; $resPADBID = mysql_query($getPADBID) or die(mysql_errno() . mysql_error()); while ($row_paddles = mysql_fetch_array($resPADBID)) { $padusrID = $row_paddles['user_id']; $padass = $row_paddles['pad_num']; echo $padusrID."<br />"; $getPaddle_data = "SELECT jos_bid_auctions.id as a_id, title, jos_comprofiler.user_id as uid, jos_bid_paddles.assignee as assign, "; $getPaddle_data .= "jos_comprofiler.firstname as pfname, jos_comprofiler.lastname as plname, "; $getPaddle_data .= "jos_bid_paddles.pad_num as ppadnum, jos_bid_paddles.assignee as assignee "; $getPaddle_data .= "FROM jos_bid_auctions "; $getPaddle_data .= "LEFT JOIN jos_comprofiler ON jos_comprofiler.user_id "; $getPaddle_data .= "LEFT JOIN jos_bid_paddles ON jos_bid_paddles.user_id "; $getPaddle_data .= "LEFT JOIN jos_bid_categories ON jos_bid_categories.id "; $getPaddle_data .= "WHERE jos_comprofiler.user_id = ".$padusrID." "; $getPaddle_data .= "AND jos_comprofiler.user_id = jos_bid_paddles.user_id "; $getPaddle_data .= "AND jos_bid_categories.active = 1 "; $getPaddle_data .= "ORDER BY jos_comprofiler.firstname ASC"; $resPaddleData = mysql_query($getPaddle_data) or die(mysql_errno() . mysql_error()); //echo $getPaddle_data."<br /><br />"; // Testing SQL $row_paddles = mysql_fetch_array($resPaddleData); $user = $row_paddles['uid']; $pfname = $row_paddles['pfname']; $plname = $row_paddles['plname']; $ppadnum = $row_paddles['ppadnum']; $passignee = $row_paddles['assignee']; echo $pfname.", ".$plname." - ".$ppadnum."<br />"; if ($ppadnum == NULL) { // Nada to da data... } else { echo "<tr><td width='200'>"; echo $pfname." ".$plname; echo "</td><td width='65'>"; echo $ppadnum; echo "</td><td width='200'>"; echo $passignee; echo "</td></tr>"; } } As you can see, I tried to add the "$getPaddle_data .= "ORDER BY jos_comprofiler.firstname ASC";" - this doesn't work because this query is repeated for each client in the list extracted from a table that only has client id's. Any ideas? For those interested: I joined the same tables required to the SQL outside the while loop, like thus: $getPADBID = "SELECT * FROM jos_bid_paddles LEFT JOIN jos_comprofiler ON jos_comprofiler.user_id WHERE jos_comprofiler.user_id = jos_bid_paddles.user_id ORDER BY jos_comprofiler.firstname ASC";
  10. Bummer! Well, I can add an _instr (it's the condition of the instrument) to the database column and I'll have to update the other insert entry on another page, not too much hassle. Thanks for your help! ;D Rich
  11. Okay - tho I just copied the error bit. INSERT INTO jos_bid_auctions (userid, title, shortdescription, description, picture, initial_price, automatic, shipment_info, reserve_price, cat, vat_rate, est_low, est_high, outside_eu, condition, receipt_num, lot_num, keywords, maker, age, rec_num, line_num, con_rec_num, lot_order) VALUES ('7807', 'A Guitar by Louis Panormo, London 1837', 'A Guitar by Louis Panormo, London 1837', 'A Guitar by Louis Panormo, London 1837 Labelled: Louis Panormo the only maker of guitars in the Spanish style...Bloomsbury...London 1837 The back and ribs of rosewood, the table of medium grain spruce, the sound hole set with concentric circles inlaid with mother of pearl lozenges, the bone rollers, the brass machines by Rance, the mother of pearl tuners, the head stock stamped: Pratten, and bearing the seal of Sydney Pratten, a stylised monograph in red wax', '1005/1_Lot-108f.jpg', '1', '0', '', '0', '1', '', '1200', '1800', '', 'Good', '0', '108', 'guitar', '', '', '3218', '1', '0', '2') 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition, receipt_num, lot_num, keywords, maker, age, rec_num, line_num, con_re' at line 1
  12. Hi all, Having a little problem with my mysql insert in PHP, not sure which forum to have it in. Here's the code: // Insert the copied lot into the unassigned lots listings $put_CopiedLot = "INSERT INTO jos_bid_auctions "; $put_CopiedLot .= "(userid, title, shortdescription, "; $put_CopiedLot .= "description, picture, initial_price, "; $put_CopiedLot .= "automatic, shipment_info, reserve_price, "; $put_CopiedLot .= "cat, vat_rate, est_low, est_high, "; $put_CopiedLot .= "outside_eu, condition, receipt_num, "; $put_CopiedLot .= "lot_num, keywords, maker, "; $put_CopiedLot .= "age, rec_num, line_num, "; $put_CopiedLot .= "con_rec_num, lot_order) "; $put_CopiedLot .= "VALUES ("; $put_CopiedLot .= "'".$userid."', '".$title."', '".$shortdesc."', "; $put_CopiedLot .= "'".$description."', '".$picture."', '".$initial_price."', "; $put_CopiedLot .= "'".$automatic."', '".$shipment_info."', '".$reserve_price."', "; $put_CopiedLot .= "'1', '".$vat_rate."', '".$est_low."', '".$est_high."', "; $put_CopiedLot .= "'".$outside_eu."', '".$condition."', '".$receipt_num."', "; $put_CopiedLot .= "'".$lot_num."', '".$keywords."', '".$maker."', "; $put_CopiedLot .= "'".$age."', '".$rec_num."', '".$line_num."', "; $put_CopiedLot .= "'".$con_rec_num."', '".$lot_order."') "; echo $put_CopiedLot; $rCopiedLot = mysql_query($put_CopiedLot) or die(mysql_errno() . mysql_error()); I can't see anything wrong with it, but it reports an error: "1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition, receipt_num, lot_num, keywords, maker, age, rec_num, line_num, con_re' at line 1" Now I've figured out from previous errors like this that it's usually just before the part of the query that's actually quoted... But I can't see anything wrong with the code. I kept the names the same for ease of use here, and the spelling is OK... It was all cut and pasted so if there are any errors it should be right at the start, but nooooo..... Mysql Ver: 5.0.51a-community-nt running on Wamp Server 2 Maybe I haven't had enough coffee or too much :-\
  13. And another tip: Code for IE. Firefox has less hassle with CSS and layouts than IE, which tends to interpret code a little more literally. Is there a specific problem with the site? I can't see anything drastically wrong in FF, nor in IE7
  14. Like I said, this resets everything to start from scratch. What this means is that, for example, IE adds a border at the top of the browser in <body>, yet FF doesn't. So the reset CSS I use makes sure that both IE and FF (and Safari, Konqueror, Opera, etc) all start from the same point. When I now set any definitions on the <body> tag as above, it means I get it right on all browsers. This cuts down my build times, and also testing times on each browser platform. This is what I do. That code I suggested has saved clients hundreds of pounds in expenditure when having new sites built. Hope that explains things. The reason I list all the elements is so that I have absolute control and can add/remove them depending on the site I build and it's intended use. For instance, I quite often remove abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, Because I use them very little. It's easier to do that rather than write them every time because I've done it like you suggested with a * { ... } YMMV, and I am only suggesting my own method, which works very well for me. Best of luck! Rich
  15. I tend to reset everything and start from scratch with CSS... Here's my master reset CSS (I work with Joomla sometimes, so I've included both). Hope this helps! /* Full Reset - adapted. */ /* README - THIS IS IMPORTANT!!!! */ /* The first listing is for Joomla systems, the second is for HTML pages/PHP scripts, etc. */ /* provides complete reset for all browsers */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, .contentpaneopen, .contentheading { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; outline:none; } /* provides complete reset for all browsers */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; outline:none; } body { font-family: Arial, Helvetica, sans-serif; } td { font-family: Arial, Helvetica, sans-serif; } th { font-family: Arial, Helvetica, sans-serif; }
  16. Hi, I've been developing some php scripts for administering a mysql database. I'm looking at the next stage of this project to expand my new found love for programming into Java, and would like to create a standalone version of the management scripts. This may end up being used on a machine that does not have mysql installed, so I need to know basic answers to the following: Is it relatively easy to translate PHP to Java? Can I potentially download the mysql database (either directly via a remote account or ftp) and allow Java to write/edit, the re-upload or synchronise? I am aware that Java is reasonably platform independent AFAIK, is this really true? I wouldn't have to code different programs based on different machines? In this case, I am likely to see this installed on Intel PC's, Intel Mac and PowerPC Mac also. The reason I ask this is that even in today's age, you can never guarantee a net connection, and need to suss out how to implement an alternative local method that matches the web interface version. Kind of life POP3 webmail => Outlook sort of thing. Thoughts and opinions appreciated. Rich
  17. Hi, I'm having a little trouble :-\ SOLVED IT - I'm such a muppet - all I had to do was DISTINCT on the first item in the query (jos_comprofiler.user_id) and it works. Sorry! I've created a system to allow people to register interest in items for sale prior to 'release'. They do this over the phone, and an administrator basically ticks off the items and it gets stored into a database: id / item_id / client_id I did this so that more than one person can be interested is the same item. However, when creating a dropdown with names based on client_id, I get multiple names. As I'm using a join across the tables, I can't figure how I'm going to allow it to be distinct names, or is there another way? Here's the db query: $view_telebidders = "SELECT jos_comprofiler.user_id, firstname, lastname "; $view_telebidders .= "FROM jos_comprofiler "; $view_telebidders .= "LEFT JOIN jos_bid_telebids "; $view_telebidders .= "ON bidder_id "; $view_telebidders .= "WHERE jos_bid_telebids.bidder_id = jos_comprofiler.user_id "; $view_telebidders .= "ORDER BY lastname ASC"; $res_telebidders = mysql_query($view_telebidders) or die(mysql_errno() . mysql_error()); // GENERATE $row_select_telebidders = mysql_fetch_assoc($res_telebidders); $totalRows_select_telebidders = mysql_num_rows($res_telebidders); And here's the dropdown: <td><select name="teleselect" onchange="this.form.submit()"> <option value='none'>-- Select Telephone Bidder --</option> <?php do { if ($useridassign==$row_select_telebidders['user_id']) { echo "<option value ='".$row_select_telebidders['user_id']."' selected>".$row_select_telebidders['firstname']." ".$row_select_telebidders['lastname']."</option>"; } else { echo "<option value ='".$row_select_telebidders['user_id']."'>".$row_select_telebidders['firstname']." ".$row_select_telebidders['lastname']."</option>"; } } while ($row_select_telebidders = mysql_fetch_assoc($res_telebidders)); $rows = mysql_num_rows($res_telebidders); if($rows > 0) { mysql_data_seek($res_telebidders, 0); $row_select_telebidders = mysql_fetch_assoc($res_telebidders); } ?> </select></td> Last, but not least, source code of the output, so you can see the duplicates: <td><select name="teleselect" onchange="this.form.submit()"> <option value='none'>-- Select Telephone Bidder --</option> <option value ='7797'>Robert Bringham</option> <option value ='7814'>Johan Hansson</option> <option value ='7814'>Johan Hansson</option> <option value ='7820'>Stephen Smith</option> <option value ='7820'>Stephen Smith</option> </select></td> It's odd that Robert Bringham only comes up once. What's gone wrong? ???
  18. You are an absolute star! Now I can use that to do the update to the database, and get on with my work
  19. Thanks! Glad I'm heading in the right direction I'm doing it all in a while... loop, is that wrong? Also, the problem I have with arrays is this $array_items = array("item1", "item2", "item3"); Sounding really dull, but what do I do with this, as this information is from a database. Would I be right again in thinking that everything for the table row can be placed in the foreach loop underneath this?
  20. Maybe it's because I've got stinkin' man flu or what, I just can't get this right.... I need to show a list of products, with tickboxes next to each, so that people can express an interest in them. I have the database fields set up, and customer name set up too. Here's my current code: // Get the clients $getClients = "SELECT user_id, firstname, lastname FROM jos_comprofiler ORDER BY firstname ASC"; $resClients = mysql_query($getClients) or die(mysql_errno() . mysql_error()); // Generate User Lists $row_selectuser = mysql_fetch_assoc($resClients); $totalRows_selectuser = mysql_num_rows($resClients); ?> <form action="sale.php" method="post" name="processtele"> <input type="hidden" name='telebids' value='telebids' /> <input type="hidden" name="updatetele" value="updatetele" /> <tr> <td width="150"><?php echo PAD_select_client; ?></td> <td> <select name="getTELE"> <option>-- Select a Name --</option> <?php do { echo "<option value='".$row_selectuser['id']."'>".$row_selectuser['firstname']." ".$row_selectuser['lastname']."</option>"; } while ($row_selectuser = mysql_fetch_assoc($resClients)); $rows = mysql_num_rows($resClients); if($rows > 0) { mysql_data_seek($resClients, 0); $row_selectuser = mysql_fetch_assoc($resClients); } ?> </select> </td> </tr> </table> <br /> <table width="928" cellpadding="0" cellspacing="0" border="0"> <?php // Get the sale $getSALE = "SELECT lot_order, title, cat, jos_bid_auctions.id AS bidid FROM jos_bid_auctions LEFT JOIN jos_bid_categories ON jos_bid_categories.id WHERE jos_bid_categories.active = 1 AND jos_bid_categories.id = jos_bid_auctions.cat"; $resSALE = mysql_query($getSALE) or die(mysql_errno() . mysql_error()); while ($row_lots = mysql_fetch_array($resSALE)) { echo "<tr>\n"; echo "<td width='50'>\n"; echo $row_lots['lot_order']; echo "</td>\n"; echo "<td>\n"; echo $row_lots['title']; echo "</td>\n"; echo "<td>\n"; echo $row_lots['cat']; echo "</td width='50'>\n"; echo "<td>\n"; echo "<input type='hidden' name='declare[]' value='".$row_lots['bidid']."' />"; echo "<input type='checkbox' name='telebidset[]' value='".$row_lots['bidid']."' />"; echo "</td>\n"; echo "</tr>\n"; } echo "<tr><td colspan='4'><br /><br />"; echo "Save Telephone Requests: "; //echo "</td><td colspan='3'>"; echo "<input type='submit' name='submittele' value='Save' />"; echo "</td></tr>"; ?> </form> </table> <?php } I've never had much luck with arrays... When I get some spare time I'll do some proper learning of them, but deadlines are tight... I am aware of using [] like this: name='something[]' , but with checkboxes, I can't get the fields to match up. For example, if I had 5 items, and selected the 2nd and 3rd, the checkbox would show [0] => id2 and [1] => id3, but the declare[] results with [0] => id1 and [1] => id2. Heres the POST result of selecting the second item on it's own: [declare] => Array ( [0] => 13 [1] => 14 ) [telebidset] => Array ( [0] => 14 ) This obviously screws up the results, and then I need to insert the results into the database using update. Would I be right in guessing that I need to use a foreach loop to do the insert? If this is right I can use the id because that's the ID number in the database, and that's pretty easy. Help
  21. Hi, I've set up a form to process an array of items, and I can get the form to return, save, etc. But I noticed a small problem - when submitting a checkbox, the array sets it to [0], and not it's position in the form list. Here's the source for the form: // Create the table full of sale data while ($row = mysql_fetch_assoc($rSaleList)) { echo "<tr>\n"; echo "<td>\n"; echo "<input type='text' name='id[]' size='7' value='".$row['id']."' READONLY />"; echo "</td>\n"; echo "<td>\n"; echo "<input type='text' name='sale_num[]' size='2' maxlength='1' value='".$row['salenum']."' />"; echo "</td>\n"; echo "<td width='140'>\n"; echo "<input type='text' name='day[]' value='".$row['day']."' size='1' maxlength='2' /> - <input type='text' name='month[]' value='".$row['month']."' size='1' maxlength='2' /> - <input type='text' name='year[]' value='".$row['year']."' size='3' maxlength='4' />"; echo "</td>\n"; echo "<td width='50'>\n"; if ($row['active'] == 1) { echo "<input type='checkbox' name='published[]' value='1' "; echo "checked='yes'"; echo " />"; } elseif ($row['active'] == 0) { echo "<input type='checkbox' name='published[]' value='0' "; echo "/>"; } echo "</td>\n"; echo "</tr>\n"; } And here's the POST output after submitting, with the third item (out of 6) checked: POST: Array ( [id] => Array ( [0] => 1012 [1] => 1000 [2] => 4 [3] => 3 [4] => 2 [5] => 1 ) [sale_num] => Array ( [0] => 2 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 1 ) [day] => Array ( [0] => 11 [1] => 11 [2] => 00 [3] => 00 [4] => 00 [5] => 00 ) [month] => Array ( [0] => 03 [1] => 03 [2] => 00 [3] => 00 [4] => 00 [5] => 00 ) [year] => Array ( [0] => 2009 [1] => 2009 [2] => 0000 [3] => 0000 [4] => 0000 [5] => 0000 ) [published] => Array ( [0] => 0 ) [updateSale] => Update Sales So how would I get [published] to show [4] => 0 ? (or 1, depending on it's selection)... TIA
  22. I was looking at the possibility of importing a set of existing PDF files to an admin system, and the FPDF site suggested using FPDI. I've installed this, yet the best I can get is: Fatal error: Class 'FPDF' not found in D:\Documents\wamp\www\test-bench\fpdf\fpdf_tpl.php on line 20 Yet on line 20 it states : class FPDF_TPL extends FPDF { And not knowing enough about classes to figure out if this is wrong or not. Any help would be greatly appreciated.
  23. Thanks guys - worked a charm. I'll have to remember that!
  24. Hi all, I've been developing a system to administrate the backend operations of a website, extending the functionality of an existing database. I'd like to run some tests from scratch, so I'd like to create an identical copy of the database, retaining the table structures and any default values, but with empty rows. How would I do this? I don't have much experience with mysql, though I can write basic commands and am reasonably familiar with phpmyadmin too. TIA Rich
  25. solved it using Javascript from this page: http://www.quirksmode.org/dom/usableforms.html Thanks anyway.
×
×
  • 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.