Search the Community
Showing results for tags 'form fields'.
-
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(); ?>
-
I am trying to create a search query for either the YearBuilt (yachts.theskywatergroup.com/yatco_data_feeds/datafeed_customer/query2.php) or LocationState a Vessel is located in (yachts.theskywatergroup.com/yatco_data_feeds/datafeed_customer/query3.php.) See attached files. I can only get the full return of the URI. I am not fluent in PHP coding as I am more involved in web design, graphics, emarketing, etc., but want to learn this for one of my friend's who is a Yacht broker. Part of the example response data from the "Search" URI is below. A few questions as this is new to me - 1 - What are the numbers and "String content" in JSON? 2 - Can $_Get('City') be a request from a form? 3 - Is it my code in the attached files or is there something else I need from the providing Dataservice? { "PageCount":"2147483647, "RecordCount":2147483647, "Vessels":[( "AskingPriceFormatted":"String content", "City":"String content", "VesselID":2147483647, "YearBuilt":2147483647 )] } query3.php query_results3.php query_results2.php query2.php