Jump to content


  • Posts

  • Joined

  • Last visited

About AV1611

  • Birthday 03/03/1965

Profile Information

  • Gender
    Not Telling

AV1611's Achievements

Advanced Member

Advanced Member (4/5)



  1. Thank you. Unfortunately the tutorial doesn't answer my question. 1. I don't know AJAX 2. While I know many disagree, I don't need to use jQuery, and have no idea how to use it. Please let's don't argue about that. 3. When I fill in the initial < input type = text > I assume I need to do onChange = myFunction() 4. so I really need to know how to write myFunction. I can write the PHP script that gets queried by myFunction. Your tutorial, aside from using Jquery which I don't really understand, drives a pulldown from another pulldown , I think... I am 6 months into this project, and don't really want to change to jQuery at this point.
  2. Ok, I have NEVER tried to use AJAX before. I have a web application that requires the user to select an item from a pulldown. The first input is a Lot number. The info to build the select list is generated via an MySQL query. Now, here's the thing. There are MANY items in the pulldown (1,000) which is not practical. I would like to run a query modified by the string they put in the first input box. I'm trying to avoid a page reload. So, Here is the input box <input name="lotno" /> Here is the basic pulldown code: echo "<option value='void'>--- Select a test ---</option>"; $sql='SELECT distinct `test_templates`.`tempid`, concat(`test_templates`.`assy`," - ",`test_templates`.`testdesc`) as Description FROM `test_templates` ORDER BY `assy` ASC'; $result = mysql_query($sql); while($row=mysql_fetch_array($result)){ echo "<option value='".$row[0]."'>"; echo $row[1]; echo "</option>"; } } I would change the above SQL with ...WHERE `lot` like WHATEVER IS IN THE lotno input field. Then the result of the query would be very limited. Thanks in adanced.
  3. value is now 1-1, 1-2, 2-5, etc. The first number goes to the pulldown and selects it, the second number goes to the text box. it works great
  4. You can use split(): var parts = someval.split('-'); // parts[0] now contains "12" // parts[1] now contains "99" Not quite. You want to select a sub-string of someval; currently you're trying to select it from the input's DOM object. With the parts array though you don't need to use substring: document.formName.inputName1.value = parts[0]; document.formName.inputName2.value = parts[1]; Thanks for helping. One final little question. If parts[0] corresponds to a pulldown rather than a text input, would it still work? Apple <----value=1 Banana <--Value = 2 Frog<-------Value = 3 ??
  5. thank you for the reply. How do I "split" the value? <input value="12-99"...> I want the substring 12 in the first input field and 99 in the second input field. is document.formName.inputName1.substring(someval(0,1)) (not sure of the JS syntax) valid?
  6. Can this not be done?
  7. Let me start by saying I don't know JS. I only know PHP/HTML. That being said, I have a form with 2 input fields. I have a button. I want to press the button and have it autopopulate the two input fields. example. button: [12-84]<--- click this and input 1 now has a 12 and input 2 now has an 84 in it. They can also manually enter the date in the fields. I know I can do <script> function transferField(someval){ document.form.code.value = someval; } </script> <input button id=code onclick="transferField(this.value)"....> blah blah... but that only does a single field. I want the one button click to do to values to two seperate input fields. Thanks
  8. AV1611

    verify string

    fair enough... also I guess it's preg_match as the other is deprecated now... ...for my education, can someone tell me how to syntax the above with regex?
  9. Ok, so I need a form to validate that the data entered was a 10 digit number ONLY. It must be a number and it must be 10 digits. if(!eregi("[0-9]{10}",$str)) echo "Invalid Serial Number"; Is this right?
  10. You guys are awesome... I was trying to get the final answer (please don't laugh too loud... it would have worked... but I didn't get part of it right...) anyways, here's my crappy approach. Remember, I don't know regex, but I can improvise LOLOL $string = "CX1,CX2-6,CX7,CX9-CX11"; preg_match('~([a-z]+)(\d+)(?:-(\d+))?~i',$string,$parts); $prefix = $parts[1]; $string=str_replace(" ","",$string); $string=str_replace($prefix,"",$string); $string = explode(",",$string); $c=count($string); $i=0; while($i < $c){ $s=explode("-",$string[$i]); $ct=count($s); $ci=0; while($ci < $ct){ echo $prefix . $s[$ci] . "<br />\r\n"; $ci++; } $i++; }
  11. Oops... one last problem... The data is coming from a VERY old database, and the data syntax is not always the same. The following is possible: $str="CX1,CX2-6,CX7,CX9-CX11"; They did CX2-6, then later CX9-CX11. That seems to be a small issue as well... I am so sorry...
  12. Almost works... $str = CX1,CX2-6,CX7 yields: CX1,X2,X3,X4,X5,X6,CX7 Seems to work other than that...
  13. I figured I would have to explode the "," then the -... but how do I get the "alpha" character, seeing it may be 1-3 characters long? i.e. R, C, CX, etc...? Maybe something that does "grab the beginning of the string until you encounter a number"? How do I do that?
  14. First, hello to those who may remember me from YEARS ago Anyways, after all these years, I still suck at regex, so here's a real world problem I need help with: Query returns something like this: C1,C2-6,C7,C14,C15-43 or: C1,C2-C6,C7 or: CX1,CX2-15 or: R1,R2-5,R7 etc... Anyways, I need to convert to this format: (I will use the last example) R1,R2,R3,R4,R5,R7 I can use array or whatever, I just don't know how to do the regex to do it... And before I get asked for code, here is what I have so far LOL... <?php $str="R1,R2-5,R7"; ?>
  • 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.