Jump to content

gobbles

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gobbles's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey Ya'll I have a bit of a problem with a script im writing and was wondering if someone could help me out. I have a number of checkboxes that are dynamically created using the following: <input type="checkbox" name="we_cater_to[]" value="<?php echo $rowresult['value'];?>" <?php if($plan == 'Free') {?> onclick="chkcontrol(<?php echo $control; ?>)" <?php } else {} ?>> I also have a javascript function that limits the amount of checkboxes clickable to 3 which is as follows: <script type="text/javascript"> function chkcontrol(j) { var total=0; for(var i=0; i < document.createlisting.we_cater_to.length; i++){ if(document.createlisting.we_cater_to[i].checked){ total =total +1;} if(total > 3){ alert("Please Select only three") document.createlisting.we_cater_to[j].checked = false ; return false; } } } </script> The problem im having is with the name of the checkboxes "we_cater_to[]" ... If i remove the [] at the end it all works perfect, except that the checkboxes dont save in the way i want them to ... so i need the [] to make the array ... and if i add [] to the javascript function then the function doesnt work at all. How do i get the javascript to work using the [] ? Any help would be great, i have been racking my brains and cant seem to get a result. Cheers,
  2. Ok, no problem .. How about assigning variable names to the checked values?
  3. Hey All, I got a bit of a problem thats giving me a major headache. I have a form which generates checkboxes from a database, so there isnt a set number of them ... they are generated by the following: while ($listing_row = mysql_fetch_array($listing_results)) { extract($listing_row); echo "<input type=\"checkbox\" name=\"checkbox\" value=\"".$description."\" id=\"list".$id."\" ><label for=\"list".$id."\"> " .$description . "</label><font color=\"#FF0000\"> - ".$date_uploaded."</font><br />\r"; } I want the next script to take each of the checked boxes and assign them to a variable so that i can recall them at a later stage. For example ... if there was 150 checkboxes and only 2 were checked, then $checked1 would equal the description of the first checked box, $checked2 would equal the description of the second checked box, and so on. Cheers
  4. Im sure theres a left join in there somewhere. Here is the table layout ---------------------------------- | packages | advertisers | ---------------------------------- | id | plan | | price | paid | | | id | | | signup_date | | | venue_name | ---------------------------------- The ID field in the packages table and the PLAN field in the advertisers table are the ones that have the same values. SELECT * FROM both tables where packages.id = advertisers.plan AND paid = YES Thats basically what i need to do If someone could actually put that into a SQL statement, it would REALLY help me out
  5. Thats just a basic search function. Im talking about a cross table query
  6. Hey All, Im having some problems with a script of mine. i have one MySQL table that has the value of an account i.e 'Free Account' = $0, 'Basic Account' = $300 .. then i have another table with the account id which would be 'Free Account' or 'Basic Account' and also a paid which is 'Yes' and 'No' How could i combine 2 tables into one search. What i want to do, is check if an account is paid, if the paid column is 'no' then display $0, but if it is 'yes' then check the account id and match it with the account id on the other table and return the value i.e $300 of that account. If that makes sense to anyone, i would really like some help. Cheers.
  7. Dang .. Thanks heaps for that
  8. Hey All, I have a database with a list of careers. I want to pull the careers from the database and display them in a table, only problem is that i need them to be displayed in 2 columns, in other words, if i have "Chef" and "Bricky" instead of easily pulling them and listing them, i want them to be side by side, 50 / 50 in 2 columns of a table. Can anybody help me out? Cheers
  9. Hi, I was wondering if its possible to query multiple tables in one query. like this: SELECT * FROM table1, table2, table3 WHERE something=something Is that possible?
  10. Hey All, Im just having a bit of a problem with a form. I have a checkbox with the following attributes <input type="checkbox" name="drivers_licence" value="YES"> in the other form i have $licence = $_POST["drivers_licence"]; Im just wondering why it would be giving me a error like the following Undefined index: drivers_licence Can anyone point out where im going wrong? Cheers
  11. What if it isnt numbers ... say the options are contact methods, Phone, Fax, Email, Mail, Car etc etc?
  12. Hey All, Im just trying to cut down on thousands of lines of code at the moment and hopefully someone could help me. I have a drop down box and the "selected" value needs to be selected by a dynamic value that gets entered into the database, this is currently how im doing it: [code]<?php                 if($modify_row[21] == "0") {                   print "<option value=\" \"></option>\n";                   print "<option value=\"1\">Active</option>\n";                   print "<option value=\"0\" selected>In-Active</option>\n";                 } elseif ($modify_row[21] == "1") {                   print "<option value=\" \"></option>\n";                   print "<option value=\"1\" selected>Active</option>\n";                   print "<option value=\"0\">In-Active</option>\n";                 } ?> [/code] At the moment i have over 100 "options" and i think it would be a major waist of code doing it this way, can someone help me out please. Its fairly straight forward, basically the option that is automatically selected needs to be the one coming from the database $modify_row[21]. Thanks All
  13. Thanks for your quick reply. I tried to implement the code that you gave, but came through with some errors, the following code works perfect if theres only 1 product in the cart, if i update the qty, everything. But it doesnt work with multiple products in the cart, when there are multiple products, it adds the primary ($products_ship_price) instead of adding the additional ($products_ship_price_two) [code] $this->vendor_shipping[$vendors_id]['ship_cost'] += ($products_ship_price); if ($this->vendor_shipping[$vendors_id]['ship_cost'] >= 2.5000)   $this->vendor_shipping[$vendors_id]['ship_cost'] = ($this->vendor_shipping[$vendors_id]['ship_cost']);     if ($quantity > 1) {       $this->vendor_shipping[$vendors_id]['ship_cost'] += ($products_ship_price_two * ($quantity-1));     } [/code]
  14. Hey All, I was wondering if someone could help me with a couple of statements im trying to write. I have a shopping cart, and im trying to implement a individual shipping cost per product and a secondary shipping price for additional products and quantitys. I just cant seem to get my head around the statement ... basically this is how it should go: if theres more than one product in the cart then get primary shipping cost of 1st product how much qty? any additional product? for each additional products and qty's use secondary shipping price ( which is defined for each product) else if there is only one product and one qty then use primary shipping cost. Hows that sound ... I cant get my head around it at all. to give a real world example: Listed below are 2 products with their details Product: Canon Digi Camera Primary Shipping Cost: $20 Additional Shipping Cost: $1 Product: DVD Player Primary Shipping Cost: $40 Additional Shipping Cost: $2 If i buy 2 digi cameras, the total shipping price will be $21 $20 + $1 If i buy 1 digi camera and 1 DVD player, the total shipping price will be $22 $20 + $2 If i buy 1 digi camera and 4 DVD players, the shipping will be $28 $20 + $2 + $2 + $2 + $2 I hope thats a better explaination of it. If any could help me get my head around this it would be greatly appreciated, i have been pulling my hair out about this for months now. Cheers
  15. Hey All, I need a bit of help with something im trying to develop. I'll lay it down and if someone could give me thoughts, code, anything that would be greatly appreciated. I have a directory ( /var/www/images/ ) where i FTP images of paintings to, the images are all different sizes. I also have an image of a timber frame. I want to be able to put the image inside the frame, but i dont want to resize the images ... i want to be able to resize the frame somehow. I can't just change the size of the frame because if there is an image that is thin, then the frame will look out of whack. Is there a way to cut up the frame and place it around the image? Any help at all would be greatly appreciated. Thanks
×
×
  • 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.