Jump to content

liquinas

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Contact Methods

  • AIM
    liquinas
  • MSN
    liquinas@comcast.net
  • Website URL
    http://www.liquinas.net
  • ICQ
    342441037
  • Yahoo
    liquinas

Profile Information

  • Gender
    Not Telling
  • Location
    Sacramento, CA

liquinas's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Having a bit of a brain fart here. This function is triggered on form submit, which works just fine and fires off heylisten(); if none of the IFs return false. The problem is that once I get to the multiple condition IF statements (the one that checks for specialty8), if the condition doesn't apply because specialty8 is not checked, it returns true and submits the form instead of continuing on to the next IF statement below it. Any help appreciated. function validate(frm) { if (frm.type[frm.type.selectedIndex].value == "") { joff(); alert("You must specify the type of person."); return false; } if (frm.fname.value == "") { joff(); alert("You must provide a first name."); return false; } if (frm.lname.value == "") { joff(); alert("You must provide a last name."); return false; } if ((frm.specialty8.checked == true) && (frm.otherspecialty.value == "")) { joff(); alert("If you select \"Other\" you must enter a description."); return false; } if ((frm.modality11.checked == true) && (frm.othermodality.value == "")) { joff(); alert("If you select \"Other\" you must enter a description."); return false; } if ((frm.service8.checked == true) && (frm.otherservice.value == "")) { joff(); alert("If you select \"Other\" you must enter a description."); return false; } if ((frm.payment0.checked == false) && (frm.payment1.checked == false) && (frm.payment2.checked == false)) { joff(); alert("You must select a payment type."); return false; } heylisten(); } //--> </script>
  2. Thanks for the reply. What I'm looking for is for .peanut to be an alternate required class in the first line of the function. Something like: var result = $('.required' OR '.peanut').map(func... How could I write this?
  3. Hi all! I have this function which checks for empty fields that have class="required" on a form before submitting. What I want to know is if I can use more than one qualifying flag. For example both class="required" and class="peanut" but not anything else. function validate() { var result = $('.required').map(function (index, domElement) { var flag = "true"; if ($(this).val().length < 1) { $(this).css({backgroundColor:"red"}); flag = "false"; } else { $(this).css({backgroundColor:"white"}); } return flag; }); return result; } Thanks in advance for any advice
  4. Thanks for the reply DarkWater. If I use include($_SERVER['DOCUMENT_ROOT'] . 'inc/php_header.php'); It goes to htdocs which isn't really the root dir (site pool). Which is why I can use include('../inc/php_header.php'); because the files in the root dir then try to pull from one level above. Any ideas?
  5. Hello again! I'm trying to pull an include on all files on a site. I'm trying to get all files in the root directory as well as all files inside folders pull the same file. I came up with this: <?php include('http://'.$_SERVER['SERVER_NAME'] . '/inc/php_header.php'); ?> <html> <head>123</head> <body> The phone number is <?php echo "$phone"; ?> </body> </html> All that's in the include file is this: <?php $phone = "555-555-5555"; ?> Problem is that $phone won't echo, however it does just fine with a regular include line: include('inc/php_header.php'); Is there a better way to do this? Am I doing something wrong? Any help appreciated. Thanks in advance.
  6. It seems to work without any nuclear explosions going off, but I might just be talking prematurely: <?php $user="liquinas"; $host="localhost"; $password="omglol"; $database = "tlcmotors"; $connection = mysql_connect($host,$user,$password) or die ("An error occured while accessing the database. Please contact liquinas@yahoo.com"); $DB = mysql_select_db($database,$connection) or die ("Error selecting database. Please contact liquinas@yahoo.com"); $query = "DELETE FROM cars WHERE ID='$lol'"; $result = mysql_query($query) or die ("Problem with Query. Contact liquinas@yahoo.com"); echo "Thingy has been deleted forever and ever<br>"; ?> ... <?php function getcarinfo() { $db = mysql_select_db("tlcmotors") or die ("Error-Could not select database. Please contact liquinas@yahoo.com"); $query = "SELECT MAX(ID) FROM cars"; $result = mysql_query($query) or die ("Error-Could not execute query. Please contact liquinas@yahoo.com"); return mysql_result($result,0,0); } $lmao= getcarinfo(); $rofl= $lmao-1; ?> ... <?php $query = "ALTER TABLE cars AUTO_INCREMENT=$rofl"; $result = mysql_query($query) or die ("Problem with Query. Contact liquinas@yahoo.com"); echo "Have a nice day.<br>"; ?> It seems to work for all intents and purposes, I'd still like to understand how it isn't a good idea?
  7. Thanks. It works. What are the two 0's for in the result line?
  8. I'm trying tot get this working. There's 6 records on a table and they have IDs 1 through 6. I need the function to get the highest value of column "ID" and then put this value on variable $lmao. <?php function getcarinfo($ID) { $db = mysql_select_db("tlcmotors") or die ("Error-Could not select database. Please contact liquinas@yahoo.com"); $query = "SELECT MAX(ID) FROM `cars`"; $result = mysql_query($query) or die ("Error-Could not execute query. Please contact liquinas@yahoo.com"); return mysql_fetch_array($result,MYSQL_ASSOC); } ?> <?php $lmao="{$carinfo ['ID']}"; echo "$lmao"; ?>
  9. Yes, I have every intent of pimping my primary keys like Cambodian hookers. And I do think it's quite lame that mysql doesn't automatically reduce it. If this task if possible via any way at all, I'd like to at least know so I can evaluate for myself whether or not it's worth it.
  10. What would be the "not advised" alternative?
  11. The front page of the site specificaly lists cars with ID 1 through 6.
  12. I have a form to edit items from the database it consists of admin.php which puts in values from the database to be displayed in form fields. Then there is process.php which redisplays the form if user left something empty but uses $_POST variables to redisplay what the user just entered instead displaying from database. Sample of field "Color" from form: <input name=\"Color\" type=\"text\" size=\"30\" maxlength=\"10\" value=\"{$carinfo ['Color']}\"/> That works just fine. On the same page I have fields to select a path for pictures. But with radio buttons. It goes as so: <tr> <td width=\"13%\"><input name=\"Pic_1\" type=\"radio\" value=\"nopic2.jpg\"/></td> <td width=\"87%\">Use default system image </td> </tr> <tr> <td><input name=\"Pic_1\" type=\"radio\" value=\"pictures/{$carinfo ['ID']}_p_1.jpg\" /></td> <td>Use image file: /pictures/{$carinfo ['ID']}_p_1.jpg</td> </tr> For all intended purposes it works, except when the user forgets to input something above, like Color, then all radio buttons switch to blank on the re-display of the form. Any way around this?
  13. Hi, my problem is a simple one yet one that causes much trouble on my application. It's a car inventory database where the owner can add, delete, and remove records. The cars on the database have ID as the primary key. There are 6 cars on the table and the PK is on auto increment so that if I add a new car right now it will be ID#7. The problem is, if I add record #7, and delete it, the auto-increment stays set, so that if I add another record, it will become ID#8 instead of 7 again. Is there anything I can add to the delete query so that the auto increment goes down by 1 each time a record is deleted? Is there any other possible solution to this? 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.