Jump to content

SF23103

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by SF23103

  1. fixed the last issue: Changed $('input[name="class_start_time"]').attr('value' , response.class_start_time); to $('input[name="class_start_time"]').val(response.class_start_time);
  2. You'll want to use a "cron job". http://forums.phpfreaks.com/topic/293523-how-i-can-make-a-script-of-my-php-code-to-work-even-if-my-website-is-not-running/?hl=%2Bcron+%2Bjob&do=findComment&comment=1501194
  3. I got this working great, and when I set it up to send the data, it only sends the form field in the select dropdown. It is not sending any of the values that are filled by AJAX. Is it not truly changing the value of the text box? Is there any way to truly fill that text box with the value for the form submission?
  4. EDIT: Got it working! Just changed all the class_number to course_number throughout the whole thing instead of trying to move it to class_number after all the MySQL stuff was done. That way I did't miss any. Still leaving out the below header line, as it throws an error. Its working great, and you are my hero! Thanks!
  5. Wow Ch0cu3r that is way more than I expected, thank you so much. That looks great, and I am working on implementing it. I got my class names to populate, but right now for some reason the get_class_details.php isn't running, as I am getting a server 500 error. I'm trying to turn on error reporting at it doesn't seem to give me any information. Thinking it is not running the script at all due to a syntax error I tried taking out the first line header('Content-type', 'text/json'); and it actually ran the script, of course giving an invalid request error because there is nothing set in POST, but it actually ran. I went back to the html page, and tried it out without the header info and expectedly it gave me a "Unable to perform this action at this time due to a server error" pop up message. I know we need to return the request in JSON, but it doesn't seem to like that way of doing it. Still working on finding a solution but I thought I would post this in case you had any ideas! Thanks again for your help... more than appreciated.
  6. The dropdown is going to be static based on the return from the MySQL query. So you're proposing I will use that to dynamically change the rest of the form? Alex
  7. I am stumped. I have a database similar to this: | Class Number | Class Name | Class Date | 0001 MATH 1/1/2016 0002 SCIENCE 2/1/2016 0003 HISTORY 3/1/2016 I am calling all classes where the date is > current date. All matching classes are then put into a html dropdown box. I would now like to populate two additional fields with the class number and class date based on the selection of the dropdown. I know I'll need to use AJAX, but I am a little stumped on how to get started. My first problem is that I have the beginning of the html select tag before: while($row = $result->fetch_assoc()){ and the end select tag after the }, so I can't put the two additional form fields in the loop. Any tips on where to go from here? Here's what I have so far: <?php // Get required login info include "/secret/path/to/login.php"; $db = new mysqli('localhost', $username, $password, $database); // Connect to DB using required login info if($db->connect_errno > 0){ die('Unable to connect to database [' . $db->connect_error . ']'); } unset($username);// put these variables back to null unset($password);// put these variables back to null unset($database);// put these variables back to null date_default_timezone_set('America/Los_Angeles'); // set default time zone PST $sql = "SELECT * FROM ft_form_7 WHERE class_full != 'Class Full' AND class_start_date > CURRENT_DATE()"; $result = $db->query($sql); if(!$result = $db->query($sql)){ die('There was an error running the query [' . $db->error . ']';} // show error if necessary if(mysqli_num_rows($result) < 1) { (include "/path/to/get-classes-for-registration-no-classes.php"); } echo '<select name="class_drop_down">'; // opens the dropdown box while($row = $result->fetch_assoc()){ echo '<option value="'.$row['class_name'].'">'.$row['class_name'].'</option>'; } echo '</select>'; $db->close(); $result->free(); ?>
×
×
  • 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.