Search the Community
Showing results for tags 'passing variables'.
-
Hi guys and let me say this that i desperately need help on this seemingly no problem at all !! Ya so I am back again with another head swirler, at least for me. Needless to say I have been trying to figure it out for 2 days now and I was sure I cud do it without help but guess it was I was totally wrong & this is proving to be a most sly problem, one that refused to budge. So i have a Flash layer called TIMER where I have the code to display the timer and this layer also processes the time code where it uses variables like myMinute and mySeconds to hold minutes and seconds. It uses these two to store the time and then uses these to find the time elased till a BUTTON is pressed. This BUTTON triggers the handler (onPress()) which has a function say send_values() to create a set of values to send to the php. The function send_values() is described / written in the Actions Layer. Inside this layer, the two variables mySeconds and myMinutes are used to send the time to php using a variable lv1.time_in_seconds = myMinites*60+mySeconds; like this lv1.send(path+"data.php", "_blank", POST" ). ======= DEFINED IN FLASH======== var mysec:Number=mySeconds; // 20 var mymin:Number=myMinute; // 2 var vTimNsec=mymin*60+mysec; // 140 ========= SENT TO PHP =========== lv1.v_time_in_seconds = mysec; lv1.v_sums_correct = mymin; lv1.v_delay_digit_ms = vTimNsec; If I run this in the Flash (2.0) IDE and trace the values (DEFINED IN FLASH) OR display the values in a dynamic text box, I am shown the correct values. Then I send these values to PHP thru the array lv1 using the command lv1.send(path+"data.php", "_blank", POST" ); Now if i run this from a localhost with the flash embedded in the HTML file I get values vis_sum_corr = undefined // This is mymin vis_sum_tme = undefined // This is mysec vis_dig_dely = NaN // This is (mymin*60+mysec) Ok another thing that I did was that i checked the values of the variables in Flash with isNaN function and it gave me FALSE !! So the values displayed in Flash are displayed absolutely correct and the moment I send them to PHP they are changed to undefined and NaN. Has me totally zapped. Ok another thing that i checked. If i replace the variable values by numeric constants as below, ======= DEFINED IN FLASH======== var mysec:Number= 20; var mymin:Number= 2; var vTimNsec= 140; and send these to PHP, IT DISPLAYS THE CORRECT VALUES !!!!!!!!!! Can someone please guide me what is going on here and what could be going wrong. I have gone nuts trying. Desperately need some gurus to sort this out. Please help !!! Thanks all.
-
loading variables into flash from a php file. Hi guys. I wonder this has been discussed many times & having gone through many such answers I still seem not to get a reply to my problem. So i have a program in flash, which generates a button which when clicked gets a set of variables from a php file called testdata.php. Now this tesfile.php when run standalone generates correct values of variables & displays them. However when i change it to be able to send it to a flash file ( make changes in echo "&db_w_var1=$db_val1"; ) like this. the values I receive in flash are odd. in fact i get this $db_val1";exactly this for the first variable. I get this string instead of receiving an integer value 4 or maybe even a string value '4'. So can anyone looking at this tell me what could be going wrong. The following is a part of code which calls the php file to get the value of variables: var w_WS; // Database returned Written Sums var w_WT; // Database returned Written Time var w_ST; // Database returned Sum Type ( written or visual or oral) var w_end; lv1.dataType = "written"; lv1.w_sums_correct= w_sums_correct; lv1.w_time = w_time; /////////// for localhost /////////////////// lv1.sendAndLoad(path+"testdata.php",lvIn1,"POST"); // sends data values of lv1 variabless // and GETS lvIn1 value /////////// for display on a webpage (_blank) /////////////////// // lv1.send(path + "sessdata1.php", "_blank", "POST"); // or GET lvIn1.onLoad = function(success){ if(success){ w_WS = lvIn1.db_w_var1; w_WT = lvIn1.db_w_var2; w_ST = lvIn1.db_w_var3; w_end = lvIn1.db_w_end; written_data = " WT = "+w_WT; // " WS = "+w_WS + " Type = "+w_ST + "End = "+w_end; } // end success Thanks to all for any help. This has me losing my brains. please help the gurus.
-
I'm working in a system. Retrieve info using LEFT JOIN and I'd like to save this info in another table. passing those variable using $_POST I want to display $act_id_numb ( Activity ID Number ) passing to save.php page. to INSERT it to the table. in 3 days I coudnt figure that out. Any help its really apreciate it. Thanks in Advance! Angel. System retrieve some info from database and display it. to add a new record system open a new windows. and bring even more info from DB. when I try to save it. the sytem loose some info. 1- its because I dont know how to send a $act_id_numb to the Save page using $_POST it should be $_POST [ 'act_id_numb'] how can I convert form $act_id_numb to act_id_numb ( with no $ sign ) System Idea is Employees are working for Clients doing different job for them, I want to track the time that each employee spend with the Client and if there was a Power Outage be able to know about it. Image01 - retrieve data from DB ( upload it using phpmyadmin into to tbl_Layout. Image02 - I want to add a new record. but I coudnt make it to work. You can see te.php , get_te.php, save_te.php ( just for new records ) Thanks! --------- te.php --------- <script type="text/javascript" src="http://code.jquery.c...n.js"></script> <script type="text/javascript" src="http://www.jeasyui.c...n.js"></script> <script type="text/javascript"> var url; function newUser(){ $('#dlg').dialog('open').dialog('setTitle','New Activity'); $('#fm').form('clear'); url = 'save_te.php'; } function editUser(){ var row = $('#dg').datagrid('getSelected'); if (row){ $('#dlg').dialog('open').dialog('setTitle','Edit'); $('#fm').form('load',row); url = 'update_te.php?id='+row.id; } } function saveUser(){ $('#fm').form('submit',{ url: url, onsubmit: function(){ return $(this).form('validate'); }, success: function(result){ var result = eval('('+result+')'); if (result.success){ $('#dlg').dialog('close'); // close the dialog $('#dg').datagrid('reload'); // reload the user data } else { $.messager.show({ title: 'Error', msg: result.msg }); } } }); } function removeUser(){ var row = $('#dg').datagrid('getSelected'); if (row){ $.messager.confirm('Confirm','Are you sure?',function®{ if ®{ $.post('remove_te.php',{emp_id:row.emp_id},function(result){ if (result.success){ $('#dg').datagrid('reload'); // reload the user data } else { $.messager.show({ // show error message title: 'Error', msg: result.msg }); } },'json'); } }); } } </script> </head> <body> <?php include 'conn.php'; ?> <h2 align="center"><a href="index.php">Main Menu </a></h2> <div class=container> <h2 style="text-align: left;">TEMS 2013 [ C.R.U.D.]</h2> <div class="demo-info" style="margin-bottom:10px"> <div class="demo-tip icon-tip"> </div> <div>Click the buttons on datagrid toolbar to do crud actions.</div> </div> <table id="dg" title="TEMS Activities" class="easyui-datagrid" style="width:900px;height:350px" url="get_te.php" toolbar="#toolbar" pagination="true" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th align="center" field="lo_id">Rec.</th> <th field="lo_client_id">Client #</th> <th align="center" field="client_desc">Name</th> <th align="center" field="lo_empl_id">Empl #</th> <th field="emp_last_name"> Firt N.</th> <th field="emp_first_name"> Last N.</th> <th align="center" field = "lo_act_id"> Act.# </th> <th align="center" field = "act_id_numb"> Act.2 </th> <th field = "act_desc"> Desc.</th> <th align="center" field="lo_time"> Time </th> <th field = "lo_desc"> Cause </th> <th field="m_desc"> Month</th> <th field="lo_year"> Year</th> </tr> </thead> </table> <div id="toolbar"> <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">New</a> <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Edit</a> <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeUser()">Remove</a> </div> <div id="dlg" class="easyui-dialog" style="width:600px;height:480px;padding:10px 20px" closed="true" buttons="#dlg-buttons"> <div class="ftitle">Information</div> <form id="fm" method="post" novalidate> <?php // --------- Form Start ---------------- ?> <div class="fitem"> <?php include 'conn.php'; $sqlc = "SELECT client_desc,client_code FROM tbl_Client"; $resultc = mysql_query($sqlc); echo "<select name='lo_client_id'>"; echo "<OPTION selected>--Select--</OPTION>"; while ($rowc = mysql_fetch_array($resultc)) { echo "<option value='" . $rowc['client_code'] . "'>" . $rowc['client_desc'] . " - ".$rowc['client_code'] . "</option>"; } echo "</select>"; ?> </div> <div class="fitem"> <?php $sql1 = "SELECT emp_code, emp_last_name,emp_first_name FROM tbl_Employee"; $result1 = mysql_query($sql1); echo "<select name='lo_empl_id'>"; echo "<OPTION selected>--Select--</OPTION>"; while ($row1 = mysql_fetch_array($result1)) { echo "<option value='" . $row1['emp_code'] . "'>" . $row1['emp_last_name']. ", ".$row1['emp_first_name'] . "</option>"; } echo "</select>"; ?> </div> <div class="fitem"> <select name="lo_month" size="1"> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="lo_year" size="1"> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> </select> </div> <div class="fitem"> <?php $sql_act = "SELECT * FROM tbl_Activ where act_id_numb=$lo_act_id ORDER BY act_title_id_numb"; $result_act = mysql_query($sql_act); ?> <br> <table id="tb" cellspacing="0"> <thead><tr><th>Title ID</th><th>Act ID</th><th>Desc</th><th>Time</th></tr></thead> <tbody> <?php while ($row_act = mysql_fetch_array($result_act)) { $act_title_id_numb = $row_act['act_title_id_numb']; $act_id_numb = $row_act['act_id_numb']; $act_desc = $row_act['act_desc']; echo '<tr>'; echo '<td align="right"><b>' . $act_title_id_numb . '</b></td>' . '<td align="right">' . $act_id_numb . '</td>' . '<td class="even">' . $act_desc . '</td>'; ?> <?php echo '</tr>'; } ?> </tbody> </table> </div> </div> <?php // --------- Form End ------------- ?> </form> </div> <div id="dlg-buttons"> <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()">Save</a> <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a> </div> </div> </body> </html> -------------- get_te.php -------------- <?php $page = isset($_POST['page']) ? intval($_POST['page']) : 1; $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10; $offset = ($page-1)*$rows; $result = array(); include 'conn.php'; $rs = mysql_query("select count(*) from tbl_Layout"); $row = mysql_fetch_row($rs); $result["total"] = $row[0]; $rs = mysql_query("SELECT * FROM tbl_Layout LEFT JOIN tbl_Client ON lo_client_id=client_code LEFT JOIN tbl_Employee on lo_empl_id = emp_code LEFT JOIN tbl_Activ on lo_act_id = act_id_numb LEFT JOIN tbl_Month on lo_month = m_numb limit $offset,$rows"); $items = array(); while($row = mysql_fetch_object($rs)){ array_push($items, $row); } $result["rows"] = $items; echo json_encode($result); ?> ----------------- save_te.php ---------------- <?php $lo_client_id = $_REQUEST['lo_client_id']; $lo_empl_id = $_REQUEST['lo_empl_id']; $lo_month = $_REQUEST['lo_month']; $lo_year = $_POST['lo_year']; $act_id_numb = $_POST['act_id_numb']; $act_time = $_REQUEST['act_time']; $lo_desc = $_REQUEST['act_desc']; //********************************************************************************** // // I just start using POST instead of REQUEST ( I read about the risk of $_REQUEST ) // windows.onload: // To check and see the variables sent by te.php // // This page receive // YES = $lo_client_id, $lo_empl_id, $lo_month , $lo_year // No = $act_id_numb, $act_time, $lo_desc // //********************************************************************************** echo '<script type="text/javascript"> window.onload=function(){alert("' . $lo_client_id . " - " . $lo_empl_id . " - " . $lo_month . " - " . $lo_year ." - " . $act_id_numb . " - " . $act_time . " - " . $lo_desc . '");} </script>'; include 'conn.php'; $result = @mysql_query($sql); if ($result){ echo json_encode(array('success'=>true)); } else { echo json_encode(array('msg'=>'Some errors occured.')); } ?>