User Profile

Collapse

Profile Sidebar

Collapse
cptuser
cptuser
Joined: Mar 30 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Terrific thanks!
    "=" means set
    "==" means compare
    See more | Go to post

    Leave a comment:


  • Javascript - Disabled and Re-enable select form element

    Hi,

    I have an online form which has a select element, which I;m using very basic JS to enable and disable a select element based on the selection of another select element.

    For some reason, the JS disables the select element correctly, but it does not re-enable it. Could someone please help with the right code.

    here is the Javascript code.

    Code:
    function annconf() {
    
    var
    ...
    See more | Go to post

  • cptuser
    replied to SUM/Total of values from a DB Query output
    in PHP
    This is what I have and it's not working:

    Code:
    	    <?php do {           $totalBids = 0; ?>
    	      <?php echo $row_totalBids['highestBids']; ?>
    	      <?php } while ($row_totalBids = mysql_fetch_assoc($totalBids))
    		      $totalBids += $row_totalBids['highestBids']?>
    See more | Go to post

    Leave a comment:


  • cptuser
    replied to SUM/Total of values from a DB Query output
    in PHP
    Just as per my mySQL query, which obviously does not work, I'm aware of the SUM() function in MySQL, however, I don't want just the SUM() of all rows, I need to first get the maximum values from the table and then add them up. I know this would be hard to do in MySQL and would need a double query or something.

    It's best to ignore MySQL for now, what I'm after rather is doing SUM using PHP.
    So, like my orginal post, sum up, (add...
    See more | Go to post

    Leave a comment:


  • cptuser
    replied to SUM/Total of values from a DB Query output
    in PHP
    Thanks for the reply. Unforutantely, I want the SUM of the MAXimum values, so essential something like this
    SELECT SUM (MAX(car_value) )... which obviously wouldn't work.
    Hence the reason why I thought first to do the MAX query using MySQL and then use a SUM function of some sort in PHP.

    Can someone assist?
    See more | Go to post

    Leave a comment:


  • cptuser
    started a topic SUM/Total of values from a DB Query output
    in PHP

    SUM/Total of values from a DB Query output

    Hi,
    I have a database query that outputs values, such as the cost of cars.

    car_id car_value

    1 20000
    2 5000
    3 1000
    4 40000
    and so on....

    How do I then write some PHP code, to add all these "car_values " from the result of the query. So if usingt he exampel above, I want to sum up, find the total, 20000+5000+1000 +40000=66000...
    See more | Go to post

  • mod_rewrite, replace spaces (%20) in URL param value with dash "-"

    Hi,

    I'm struggling to find an answer to my problem. In order to make my dynamic URLs search engine friendly, I need to replace spaces (%20) that appear in the URL with a dash "-".

    For example,
    change this dynamic URL:
    www.example.com/directory.php?n ame=very%20nice %20house

    to simply: www.example.com/very-nice-house

    Really need some help with the complete mod_rewrite code....
    See more | Go to post

  • Thanks for that. I tried your suggestion, yet it's not really working. What I need is to say have a number like 34000 to be displayed as 34,000, or 5000 as 5,000 or 300 to stay as 300.

    I'm not sure if I had made it clear in my original post.
    Many thanks....
    See more | Go to post

    Leave a comment:


  • Are you able to provide assistance taking into consideration my code that I've included in my original post. I'm struggling to follow. I dont seem to have document.write anywhere (not sure what that does and how it would fit in the code)....
    See more | Go to post

    Leave a comment:


  • Thanks for the reply. I don't see anywhere in my code where document.write is., but in anycase I've managed to derive from your suggestion and used '$'+ at the beginning of the variable - so thank you, that worked fine
    [CODE=javascript]
    document.getEle mentById('price ').value = '$+((sale_price ).toFixed(2));
    [/CODE]
    With regards to the thousands seperator, are you able to give me examples of how this can be done?
    ...
    See more | Go to post

    Leave a comment:


  • How to add '$' symbol and a thousand seperator ',' to numbers in text field

    Hi,

    I'm a novice at this. I've managed to learn by example and come up with this Javascript code from various examples on the web.

    Could someone please help me with providing code that will display the $ sign at the beginning of the number and seperate the number at thousands by a ',' in the text field (price).

    I have no idea how to do this. Many thanks

    [CODE=javascript]
    function...
    See more | Go to post

  • Thank you very much! I did tried my best and spend quite a bit of time trying to work it out. As always you guys are absolutly terrific!!!! I tried the code provided, but I get "NaN/NaN/NaN" in the second date field. Is there a reason for that? I am entering a date in the format of dd/mm/yyyy in the first date field. Not sure where it's going wrong?
    See more | Go to post

    Leave a comment:


  • Could you please kindly provide a full example based on my original explanation. This would be very helpful and I would learn quicker.
    See more | Go to post

    Leave a comment:


  • Hi,
    Sorry, but I'm afraid this does not help me at all. Can anyhow help with respect to my specific example and detailed explanation I provided.
    See more | Go to post

    Leave a comment:


  • cptuser
    started a topic Add days to a Date and display in a text field

    Add days to a Date and display in a text field

    Hi,

    I'm a novice. I need to add a certain number of days to a date entered in a field (dd/mm/yyyy) and then display the calculated date in another field in the same format, dd/mm/yyyy. Here is what I have so far. I appreciate your help:

    Code:
    function calDate() {
    	
    var date1 = new Date(document.getElementById('date_field1').value);
    document.getElementById("date_field2").value = date1.setDate(date1.getDate()+5);
    ...
    See more | Go to post

  • cptuser
    started a topic Alert if field contains particular phrase

    Alert if field contains particular phrase

    Hi,

    I'm a novice and I have the following code, but I can't get it to work. All i want to be able to do is a simple form validation for a single field, so that if the user enters a particular phrase in the field it will display an alert. So if field contains say "hello my name is john" then display an alert.

    But I also want it so that it will alert if the phrase is surrounded by other text, e.g. if the user...
    See more | Go to post

  • cptuser
    replied to getElementById containing/similar to
    Thanks for the tip. Are you able to assist with my query?...
    See more | Go to post

    Leave a comment:


  • cptuser
    started a topic getElementById containing/similar to

    getElementById containing/similar to

    Hi,

    I'm new to javascript. I need to be able to set a variable what get the value by an ID that contains a particular let and not exactly. Can one use a wild card?
    Here is what I'm trying to do:

    [CODE=javascript]var start_t_mon = document.getEle mentById("*_par tofid").value,[/CODE]

    So I want to set this variable for any form field value that contains "_partofid" !
    See more | Go to post

  • Fantastic! it worked perfectly. I just had to add the last bit which converts it back to date format and not a timestamp. Here is my final code. the url param is "date". Let me know if there is a shorter way of doing it??

    [PHP]$timeEnd = strtotime($_REQ UEST['date']); //Changes the date int he URL to linux time stamp. URL param must be yyyy/mm/dd
    $timeMon = $timeEnd - 518400; // 6 days * 24 hours/day * 60 minutes/hour...
    See more | Go to post

    Leave a comment:


  • Could you please provide me with an example code. I'm very new to PHP....
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...