Jump to content

dadamssg87

Members
  • Posts

    218
  • Joined

  • Last visited

Everything posted by dadamssg87

  1. I'm have a form with at least 3 fields(name, price, and date). I have some jquery that produces another date form input every time a certain link is clicked so there can be several date inputs. The first one(not dynamically created) has the form name "date_1". All the jquery produced inputs have the name "in_123435443453". The number after "in_" is the current timestamp. I'm trying to cycle through only the POSTs that start with "in_" and take their value to insert into database. I can't figure out how to grab the date("in_25346435253") POST in the foreach loop though because they're all unique. I'm using the codeigniter framework. That's why the code to insert into the db make look weird. <?php foreach($this->input->post() as $key => $value) { $start = substr($key, 0, 3); if($start == "in_") { $cal_id = $this->input->post('cal_id'); $exc_name = $this->input->post('exc_name'); $date = $this->input->post('???'); // <-- part i need help with $price = $this->input->post('price'); $date = date("Y-m-d 00:00:00",strtotime($date)); $data = array( 'cal_id' =>$cal_id, 'name' => $exc_name, 'date' => $date, 'price' => $price ); $this->db->insert('Exceptions', $data); } } ?>
  2. wow this is exactly what i was looking for, thanks!
  3. I'd like to learn more about programming actual things. Like say, i create a program(not sure in what language) install it onto a chip and then that chip executes the program when i push a button. So for instance, push a button, the program executes, and tells a light to blink or something to that effect. Obviously, i could just build a physical switch into the device but i'm more interested in learning how programs get executed through chips/devices. Can anyone steer me in the right direction? Books? Online tutorials?
  4. can you write javascript that produces/writes/etc. functioning javascript? for example, have a link that has a function tied to it that when clicked produces a functioning javascipt snippet? The snippet could deal with a completely other elements. For example Link #1(has the javascript function that produces javascript) Link #2(does absolutely nothing for now) Click on link #1(produces javascript snipped that says "when link #2 is clicked document.write('hello')" Clicking on link #2 now produces "hello" whereas it previously did nothing. Is that possible?
  5. I'm developing with php and trying to work jquery's datepicker into my app. I'm trying to display a datepicker that's tied to a particular input field. I have the following code. The problem is that the first time i click on the input, nothing happens. Only when I unfocus and then reclick on it will it display the picker like i want. How do i get it to display the datepicker on the first click? <script> function open_picker(X) { $( X ).datepicker({ autoSize: true, showOtherMonths: true, selectOtherMonths: true }); }; </script> <?php $datepickerid = "datepicker" ?> <input id='<?php echo $datepickerid; ?>' onClick='open_picker("<?php echo "#".$datepickerid; ?>");' type='text' value='05/21/2011' size='10'>
  6. and if that doesn work..this works form me <script> $(function() { $( "#datepicker1" ).datepicker({ autoSize: true, showOtherMonths: true, selectOtherMonths: true }); $( "#datepicker2" ).datepicker({ autoSize: true, showOtherMonths: true, selectOtherMonths: true }); }); </script> <input id='datepicker1' type='text' value='05/21/2011'><br><br> <input id='datepicker2' type='text' value='05/21/2011'>
  7. <style type="text/css"> @import "kolendar_stil.css"; </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript" src="kolendar.js"></script> <script type="text/javascript"> $(function() { $('#popupDatepicker1').datepick(); $('#inlineDatepicker').datepick({onSelect: showDate}); }); $(function() { $('#popupDatepicker2').datepick(); $('#inlineDatepicker').datepick({onSelect: showDate}); }); $(function() { $('#popupDatepicker3').datepick(); $('#inlineDatepicker').datepick({onSelect: showDate}); }); function showDate(date) { alert('The date chosen is ' + date); } </script> <p>a <input type="text" id="popupDatepicker1"></p> <p>b <input type="text" id="popupDatepicker2"></p> <p>c <input type="text" id="popupDatepicker3"></p>
  8. I have developed a calendar app. You can add events to certain days, edit, delete them, etc. It works fine now but I'm trying to improve the adding event section. I would like to be able to have a form where there are "name_of_event" and "description" inputs and then display a input that would have a date-picker. I also want to have a link/button that says something to the effect of "add additional day" and then tie a javascript function to it so when it is clicked another date-picker input will pop up under the first, and they'll be able to add as many additional days as they like. I can't figure out how to write the php code that will cycle through only the date-picker inputs though. Something like the following <?php $name = $_POST['name_of_event']; $description = $_POST['description']; foreach(datepicker_inputs as $date)// <-- part i need help with { mysql_query("INSERT INTO Events (name, description, event_date) VALUES ($name, $description, $date)"); } ?> anybody have ideas on how i can only cycle through the date inputs? I'm pretty sure i'm going to have the date input form name something like "date_1", "date_2", etc.
  9. haha yeah i don't want to do that. The creator of jQuery was doing an AMA on reddit the other day and he said he used VMWare. Was wondering if anybody on here used something like that. I'm developing locally on MAMP. I was hoping i didn't have to push everything to my host, then dust off and hook up my pc desktop to look at it through IE.
  10. What do you use to check the way your design/css looks in internet explorer? Do you have windows computers at hand or do you use some kind of software?
  11. exactly what i needed. Thanks man
  12. yes, it has to be in an array. Different price sets are stored in the database. I use a function to query for a certain price set and return the values as an array. I'm using a mvc framework...thats why the syntax may look a little unfamiliar. <?php function get_rate_values($id) { $query = $this->db->query("SELECT * FROM Rates WHERE cal_id = '$id'"); $row = $query->row(); $values['monday'] = $row->monday; $values['tuesday'] = $row->tuesday; $values['wednesday'] = $row->wednesday; $values['thursday'] = $row->thursday; $values['friday'] = $row->friday; $values['saturday'] = $row->saturday; $values['sunday'] = $row->sunday; return $values; }
  13. I have an array of dates and then i have an array for rates/prices for the days of the week. For example <?php $rate = array(); $rate['monday'] = 91.11; $rate['tuesday'] = 92.22; $rate['wednesday'] = 93.33; $rate['thursday'] = 94.44; $rate['friday'] = 105.55; $rate['saturday'] = 106.66; $rate['sunday'] = 90.00; $dateMonthYearArr = array(); $datemonthYearArr['0'] = "2011-05-06"; $datemonthYearArr['1'] = "2011-05-07"; $datemonthYearArr['2'] = "2011-05-08"; $datemonthYearArr['3'] = "2011-05-09"; $datemonthYearArr['4'] = "2011-05-10"; $datemonthYearArr['5'] = "2011-05-11"; $datemonthYearArr['6'] = "2011-05-12"; ?> I have written this to sort through the $dateMonthYearArr to determine the dates day of the week <?php foreach ($dateMonthYearArr as $date) { $sum = 0; $day = strtotime($date); $day_name = date("l", $day); echo $day_name."<br>"; } Now i'm trying to figure out how to work in the day rate array. I'd like to match up the $day_name of $dateMonthYearArr to the key of the rate array, grab that value and then add it to $sum.
  14. got it with this...accepts integers and only numbers with two decimal points. <?php function check_currency($num) { if(!is_numeric($num)) { echo "Not Numeric"; } else { $decimal_exists = strpos($num, '.'); if($decimal_exists == TRUE) { $after_decimal = strlen(substr($num, $decimal_exists + 1)); if($after_decimal !== 2) { echo "There needs to be exactly two digits after the decimal."; } else { echo "You entered the correct format for a decimal."; } } else { echo "You entered an acceptable integer."; } } }
  15. I'm trying to develop a function to check to see if the value inputted was in a currency format. I'm checking for: if the value is numeric if the value is an integer if not integer check the number of digits to the right of the decimal point I can't tell how the php function is_int() works though. I want to accept integers and also numbers with two decimal places. So accepted values will be "123" and also "123.99". The script tells me the value is not an integer no matter what. <?php $num = $_POST['number']; $positionOfDecimalPoint = strpos($num, '.'); $numbersToLeft = substr($num,0,$positionOfDecimalPoint); $numbersToRight = substr($num,$positionOfDecimalPoint + 1);//Add one so decimal point isn't included in output. echo "You submitted ".$num."<br><br>"; if(!is_numeric($num)) { echo "Not Numeric"; } else { if(!is_int($num)) { $adecimal = strlen($numbersToRight); if($adecimal !== 2) { echo "There needs to be exactly two numbers after the decimal."; } echo "<br><br>The number is not an integer."; }else { echo "The integer is ".$num; } } ?>
  16. I'm trying to wrap my head around how i should go about doing this. I have two dates...2011-05-03 and 2011-05-08. I want to write a function that creates an array of the days that consist of that date range. So say something like <?php $start = "2011-05-03"; $end = "2011-05-08"; function get_days($start, $end) { //code to get the days } echo get_days($start, $end); //hopefully produce something like... $day['1'] = "2011-05-03"; $day['2'] = "2011-05-04"; $day['3'] = "2011-05-05"; $day['4'] = "2011-05-06"; $day['5'] = "2011-05-07"; $day['6'] = "2011-05-08"; anybody know any idea how to do something like this? Pretty sure i'm going to need the mktime() function to account for ranges going across months and years.
  17. Think i figure it out with this SELECT * FROM `Bookings` WHERE END >= '$input_start' AND START <= '$input_end' UNION SELECT * FROM `Bookings` WHERE date(start) = '$input_end'
  18. i thought i had it with this but it won't catch a booking that starts on the the day the date range ends SELECT * FROM `Bookings` WHERE END >= '2011-05-02' AND START <= '2011-05-07'
  19. thanks for the quick response. i'm a little confused where i put the start and end date of the range i want to query. I'm not sure what 'field' would be in "COUNT(field)", if i obviously want to count the entire row. Also 'datetime_field'? For instance let's say i have the following <?php $input_start = "2011-05-02"; $input_end = "2011-05-07"; $table_name = "Bookings"; my table structure is as follows start datetime end datetime id int(11) name varchar(100) SELECT COUNT(field) AS cnt FROM table WHERE DATE(datetime_field) BETWEEN 'YYYY-MM-DD_start_date' AND 'YYYY-MM-DD_end_date'
  20. I have events stored in my database with start(datetime) and end(datetime). I want to query a range of two dates and count how many events fall between the range. I have no idea where to begin constructing this kind of query. Any help would be awesome.
  21. i haven't begun the process of applying for the SSL but i want to try to start learning how the whole process works. I know absolutely nothing about installing a SSL certificates but i'm at the point where i need to start learning. My structure is as follows -root -main_folder -secure_folder I want to have my main file un-SSL-ified and then when my customer's are ready to check-out, i shoot them over to the secure_folder to check-out. Does anyone know of a good resource to start learning how to SSL-ify only one directory on an Apache version 2.2.17 - server. I have cpanel, but i'm not sure their SSL/TLS Manager will allow applying the certificate to only one directory.
  22. it's just for displaying the data. I want it quoted like it should be in the database.Right now if a user inputs something like "phpfreaks" for their username then my welcome message says " Welcome 'phpfreaks'!"
  23. I'm using the codeigniter mvc framework and there's an escape function to use before adding the data to the database. This function adds single quotes around the string of data. Is there any already existing php function or does anyone know how to code a function that strips ONLY the surrounding single quotes?
×
×
  • 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.