Jump to content

kanpotter

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kanpotter's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for helping. It's doing the same thing for locations and team names drop down box too. I have three tables, locations, team members and team names. Team names relates to locations, and team members relates to team names. Seems like it's a simple solution somewhere - I just can't figure it out!
  2. From here: {"results":[{"text":"David Mecklenburger","value":"desplaines11"},{"text":"Gary Geppert","value":"desplaines11"},{"text":"David Chapa","value":"desplaines11"},{"text":"Kyle Fischer","value":"desplaines11"}]} I need David Mecklenburger, Gary Geppert, David Chapa and Kyle Fischer to post to the database and process page - not "desplaines11".
  3. That's not the problem. I need the queries to be the same because a user needs to define 4-5 team members from a drop down menu. Each of these menus have 4-5 options, just need to pick the option for each drop down and submit. Once the user has entered and/or chosen all the text on the form - www.kcwell.com/gcc_form.php I need all the chosen text to post to the mysql database and post on www.kcwell.com/gccsuccess_form.php. Instead, the ID's are posting, not the selected options. Any ideas?
  4. Here's the dbmanager.php <?php // Routine to manage errors function _error($errno, $errstr, $errfile, $errline){ print('{"error":{"message":"'.$errstr.'"}}'); } set_error_handler("_error", E_USER_ERROR); // Set the error handler // Routine to detect and create the json_encode function if (!function_exists('json_encode')){ function json_encode($a=false){ if (is_null($a)) return 'null'; if ($a === false) return 'false'; if ($a === true) return 'true'; if (is_scalar($a)) { if (is_float($a)) { // Always use "." for floats. return floatval(str_replace(",", ".", strval($a))); } if (is_string($a)) { static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"')); return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"'; } else return $a; } $isList = true; for ($i = 0, reset($a); $i < count($a); $i++, next($a)) { if (key($a) !== $i) { $isList = false; break; } } $result = array(); if ($isList) { foreach ($a as $v) $result[] = json_encode($v); return '[' . join(',', $result) . ']'; } else { foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v); return '{' . join(',', $result) . '}'; } } // End json_encode } $connection = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(), E_USER_ERROR); mysql_select_db($database) or trigger_error(mysql_error(), E_USER_ERROR); if(!empty($_REQUEST['get'])){ $query = $query[$_REQUEST['get']]; if(!empty($_REQUEST['id'])){ $query = sprintf($query, mysql_real_escape_string($_REQUEST['id'])); } $options = array(); if(!empty($query)){ $result = mysql_query($query, $connection); if(mysql_num_rows($result)){ while($row = mysql_fetch_assoc($result)){ $options[] = $row; } } } print '{"results":'.json_encode($options).'}'; } ?>
  5. Here's the connection1.php: <?php $hostname = "mysql1.myregisteredsite.com"; $database = "49200_GCC"; $username = "49200_kandace"; $password = "Leonardo56"; $query = array(); $query["locations"] = "SELECT id as value, location as text FROM locations"; $query["team_names"] = "SELECT DISTINCT team_name as text, id as value FROM team_names WHERE locations_id='%s'"; $query["team_members 1"] = "SELECT DISTINCT team_member as text, team_names_id as value FROM `team_members` WHERE team_names_id='%s'"; $query["team_members 2"] = "SELECT DISTINCT team_member as text, team_names_id as value FROM `team_members` WHERE team_names_id='%s'"; $query["team_members 3"] = "SELECT DISTINCT team_member as text, team_names_id as value FROM `team_members` WHERE team_names_id='%s'"; $query["team_members 4"] = "SELECT DISTINCT team_member as text, team_names_id as value FROM `team_members` WHERE team_names_id='%s'"; $query["team_members 5"] = "SELECT DISTINCT team_member as text, team_names_id as value FROM `team_members` WHERE team_names_id='%s'"; include "db_manager.php"; ?>
  6. MarPlo, Here's the actual page: www.kcwell.com/gcc_form.php Notice when you chose the options from "locations, team name, team captain and team members" and hit submit, they are not shown in the process page www.kcwell.com/gccsuccess_form.php. It's posting the "ids" of the selections instead of the selections. Any suggestions?
  7. I have a form that contains 3 text fields and 7 populated lists (that are dependent on the choice of the previous lists). When I post the information to MySQL and to my processing page, it posts the table "ids" instead of the selected option. Here's the php code for the form: <form action="gccsuccess_form.php" method="post" enctype="multipart/form-data" name="gcc" id="gcc"> <table width="700" border="0" align="center" cellpadding="3" cellspacing="3"> <tr> <td><label for="date">Today's Date:</label> <input type="text" name="date" id="date"></td> <td> </td> </tr> <tr> <td>Week Number: <select name="week" size="1" id="week"> <option value="0" selected>Week 0 - 3/26 - 4/1</option> <option value="1">Week 1 - 4/2 - 4/8</option> <option value="2">Week 2 - 4/9 - 4/15</option> <option value="3">Week 3 - 4/16 - 4/22</option> <option value="4">Week 4 - 4/23 - 4/29</option> <option value="5">Week 5 - 4/30 - 5/6</option> <option value="6">Week 6 - 5/7 - 5/13</option> </select></td> <td><label for="location"></label> </td> </tr> <tr> <td>Location: <select id='locations' name='location'> </select></td> <td> </td> </tr> <tr> <td><label for="label8">Team Name</label> <select id='team_names' name='team_name'> </select></td> <td> </td> </tr> <tr> <td><em>*Please enter each team member's first and last name:</em></td> <td> </td> </tr> <tr> <td><label for="mem_1"> Team <strong>Captain:</strong></label> <select id='team_members 1' name='capt'> </select></td> <td><label for="label4"><strong>Steps:</strong></label> <input type="text" name="steps_1" id="steps_1"></td> </tr> <tr> <td><label for="mem_2">Team Member #2 <strong>Name: <select id='team_members 2' name='mem_2'> </select> </strong></label></td> <td><label for="label5"><strong>Steps:</strong></label> <input type="text" name="steps_2" id="steps_2"></td> </tr> <tr> <td><label for="mem_3">Team Member #3 <strong>Name: <select id='team_members 3' name='mem_3'> </select> </strong></label></td> <td><label for="label6"><strong>Steps:</strong></label> <input type="text" name="steps_3" id="steps_3"></td> </tr> <tr> <td><label for="mem_4">Team Member #4<strong> Name</strong>: <select id='team_members 4' name='mem_4'> </select> </label></td> <td><label for="label7"><strong>Steps:</strong></label> <input type="text" name="steps_4" id="steps_4"></td> </tr> <tr> <td><label for="label">Team Member #5<strong> Name</strong>: <select id='team_members 5' name='mem_5'> </select> </label></td> <td><label for="label7"><strong>Steps:</strong></label> <input type="text" name="steps_5" id="steps_5"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><em>* Maximum steps for each team member per week is <strong>105,000. </strong></em></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit Form" id="Submit Form" value="Submit"></td> </tr> </table> <label></label> <div align="center"><br> If you have questions about the competition or reporting please contact KC WELLNESS, INC toll free at <SPAN id="lw_1237248942_0">877-634-1412.</SPAN><br> <br> </div> </form> And here's the code for the page it is posted in: <?php $date = $_POST['date']; $week = $_POST['week']; $location = $_POST['location']; $team_name = $_POST['team_name']; $capt = $_POST['capt']; $mem_2 = $_POST['mem_2']; $mem_3 = $_POST['mem_3']; $mem_4 = $_POST['mem_4']; $mem_5 = $_POST['mem_5']; $steps_1= $_POST['steps_1']; $steps_2= $_POST['steps_2']; $steps_3= $_POST['steps_3']; $steps_4 = $_POST['steps_4']; $steps_5 = $_POST['steps_5']; mysql_connect("mysql1.myregisteredsite.com", "49200_kandace", "Leonardo56") or die(mysql_error()); mysql_select_db("49200_GCC") or die(mysql_error()); mysql_query("INSERT INTO `walkathon` VALUES ('$date', '$week', '$location', '$team_name', '$capt','$mem_2','$mem_3', '$mem_4', '$mem_5', '$steps_1','$steps_2', '$steps_3','$steps_4', '$steps_5' )"); Print "Thank you for your entry. <br> Report summary: <br/><br/>"; echo "<strong> Date: </strong> {$date} <br/> <br/><strong> Week: </strong> {$week} <br/> <br/><strong> Location: </strong> {$location} <br/> <br/><strong> Team Name: </strong> {$team_name} <br/> <br/><strong> Team Captain: </strong> {$capt} / <strong> Steps: </strong> {$steps_1} <br /> <br/><strong> Team Member 2 Name: </strong> {$mem_2} / <strong> Steps: </strong> {$steps_2} <br /> <br/><strong> Team Member 3 Name: </strong> {$mem_3} / <strong> Steps: </strong> {$steps_3} <br /> <br/><strong> Team Member 4 Name: </strong> {$mem_4} / <strong> Steps: </strong> {$steps_4} <br /> <br/><strong> Team Member 5 Name: </strong> {$mem_5} / <strong> Steps: </strong> {$steps_5}" ?> How do I get the processing page to echo the selected option instead of the id?
  8. Here's the form code: </style> <script language='JavaScript' type='text/javascript' src='/db_relationallist_advanced/js/jquery-1.5.1.min.js'></script> <script language='JavaScript' type='text/javascript' src='/db_relationallist_advanced/js/db_relational_list.js'></script> </head> <body> <p> </p> <script>jQuery(function(){db_relational_list([{id:'locations', default_value:null}, {id:'team_names', default_value:null}, {id:'team_members 1', default_value:null}, {id:'team_members 2', default_value:null}, {id:'team_members 3', default_value:null}, {id:'team_members 4', default_value:null}, {id:'team_members 5', default_value:null}], '/db_relationallist_advanced/connections/connection1.php')});</script> <p align="center"><img src="picts/walk.gif" width="310" height="110" border="0"></p> <form action="gccsuccess_form.php" method="post" enctype="multipart/form-data" name="gcc" id="gcc"> <table width="700" border="0" align="center" cellpadding="3" cellspacing="3"> <tr> <td><label for="date">Today's Date:</label> <input type="text" name="date" id="date"></td> <td> </td> </tr> <tr> <td>Week Number: <select name="week" size="1" id="week"> <option value="0" selected>Week 0 - 3/26 - 4/1</option> <option value="1">Week 1 - 4/2 - 4/8</option> <option value="2">Week 2 - 4/9 - 4/15</option> <option value="3">Week 3 - 4/16 - 4/22</option> <option value="4">Week 4 - 4/23 - 4/29</option> <option value="5">Week 5 - 4/30 - 5/6</option> <option value="6">Week 6 - 5/7 - 5/13</option> </select></td> <td><label for="location"></label> </td> </tr> <tr> <td>Location: <select id='locations' name='location'> </select></td> <td> </td> </tr> <tr> <td><label for="label8">Team Name</label> : <select id='team_names' name='team_name'> </select></td> <td> </td> </tr> <tr> <td><em>*Please enter each team member's first and last name:</em></td> <td> </td> </tr> <tr> <td><label for="mem_1"> Team <strong>Captain:</strong></label> <select id='team_members 1' name='capt'> </select></td> <td><label for="label4"><strong>Steps:</strong></label> <input type="text" name="steps_1" id="steps_1"></td> </tr> <tr> <td><label for="mem_2">Team Member #2 <strong>Name: <select id='team_members 2' name='mem_2'> </select> </strong></label></td> <td><label for="label5"><strong>Steps:</strong></label> <input type="text" name="steps_2" id="steps_2"></td> </tr> <tr> <td><label for="mem_3">Team Member #3 <strong>Name: <select id='team_members 3' name='mem_3'> </select> </strong></label></td> <td><label for="label6"><strong>Steps:</strong></label> <input type="text" name="steps_3" id="steps_3"></td> </tr> <tr> <td><label for="mem_4">Team Member #4<strong> Name</strong>: <select id='team_members 4' name='mem_4'> </select> </label></td> <td><label for="label7"><strong>Steps:</strong></label> <input type="text" name="steps_4" id="steps_4"></td> </tr> <tr> <td><label for="label">Team Member #5<strong> Name</strong>: <select id='team_members 5' name='mem_5'> </select> </label></td> <td><label for="label7"><strong>Steps:</strong></label> <input type="text" name="steps_5" id="steps_5"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><em>* Maximum steps for each team member per week is <strong>105,000. </strong></em></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit Form" id="Submit Form" value="Submit"></td> </tr> </table> Here's the page where it's posted: <script>jQuery(function(){db_relational_list([{id:'locations', default_value:null}, {id:'team_names', default_value:null}, {id:'team_members 1', default_value:null}, {id:'team_members 2', default_value:null}, {id:'team_members 3', default_value:null}, {id:'team_members 4', default_value:null}, {id:'team_members 5', default_value:null}], '/db_relationallist_advanced/connections/connection1.php')});</script> <p align="center"><img src="picts/walk.gif" width="326" height="116"></p> <table width="600" border="0" align="center" cellpadding="3" cellspacing="3"> <tr> <td><p> <?php $date = $_POST['date']; $week = $_POST['week']; $location = $_POST['location']; $team_name = $_POST['team_name']; $capt = $_POST['capt']; $mem_2 = $_POST['mem_2']; $mem_3 = $_POST['mem_3']; $mem_4 = $_POST['mem_4']; $mem_5 = $_POST['mem_5']; $steps_1= $_POST['steps_1']; $steps_2= $_POST['steps_2']; $steps_3= $_POST['steps_3']; $steps_4 = $_POST['steps_4']; $steps_5 = $_POST['steps_5']; mysql_connect("mysql1.myregisteredsite.com", "49200_kandace", "Leonardo56") or die(mysql_error()); mysql_select_db("49200_GCC") or die(mysql_error()); mysql_query("INSERT INTO `walkathon` VALUES ('$date', '$week', '$location', '$team_name', '$capt','$mem_2','$mem_3', '$mem_4', '$mem_5', '$steps_1','$steps_2', '$steps_3','$steps_4', '$steps_5' )"); Print "Thank you for your entry. <br> Report summary: <br/><br/>"; echo "<strong> Date: </strong> {$date} <br/> <br/><strong> Week: </strong> {$week} <br/> <br/><strong> Location: </strong> {$location} <br/> <br/><strong> Team Name: </strong> {$team_name} <br/> <br/><strong> Team Captain: </strong> {$capt} / <strong> Steps: </strong> {$steps_1} <br /> <br/><strong> Team Member 2 Name: </strong> {$mem_2} / <strong> Steps: </strong> {$steps_2} <br /> <br/><strong> Team Member 3 Name: </strong> {$mem_3} / <strong> Steps: </strong> {$steps_3} <br /> <br/><strong> Team Member 4 Name: </strong> {$mem_4} / <strong> Steps: </strong> {$steps_4} <br /> <br/><strong> Team Member 5 Name: </strong> {$mem_5} / <strong> Steps: </strong> {$steps_5}" ?><hr> </p> </td> </tr> <tr> <td>Please log out if you are happy with your submission: <strong><a href="gcc_logout.html">Logout</a></strong></td> </tr> <tr> <td>Click here to edit your submission: <strong><a href="gcc_form.php">Edit Submission</a> </strong></td> </tr> </table>
  9. I have a form where I have inserted 7 pre-populated relational lists. All of the information is pulling correctly from the databases, but when it posts, it's posting the value "ids" instead of the chosen text. The files are: www.kcwell.com/gcc_form.php and www.kcwell.com/gccsuccess_form.php How do I set up a query to obtain the data that I need? Help!
×
×
  • 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.