PHP - Getting Undefined Using $_get Function
Hi..
I encountered problem in using $_GET to get the DATE_PROCESS. here is my code: Code: [Select] <script> function editloan(){ var dateprocess = document.getElementById('dateprocess').value; alert(dateprocess); window.location = "SSSLoan.php?dateprocess="+dateprocess; } </script> Code: [Select] <div id="searchname"> <form> <p class="serif"><b>Search Lastname:</b></p> <input type="text" name="ssssearch" size="20" onkeyup="fetchsuggest(this.value);"> <div> <hr /> <ul id="suggest" style="overflow:auto; height:380px; width:auto;"> {section name=co_emp loop=$personalAll} <li><a href="SSSgetdata.php?queryEmpID={$personalAll[co_emp].EMP_ID}">{$personalAll[co_emp].FULLNAME}</a></li> <hr /> {sectionelse} <li>No records found</li> {/section} </ul> </div> </div> <div id="loanformmain"> <input type="button" name="sssbtn" value="SSS" onclick="loanFrm()"> <input type="button" name="hdmfbtn" value="HDMF" onClick="hdmfloanFrm()"> <input type="button" name="UTbtn" value="Union Dues/Trust Fund" onclick="utloanFrm()"> </div> <div id="sssloan"> <fieldset> <legend>SSS Loan</legend> <p class="serif"> <label id="SSSLabel">SSS ID</label><label id="EMPIDLabel">EMP ID</label><label id="NAMELabel">NAME</label><label id="LOANLabel">LOAN</label><label id="AMORLabel">DEDUCTION</label> <input type="text" name="SSS" value="{$sss}" size="8" style="background: #e2e2e2" readonly="readonly"> <input type="text" name="EMP_NO" value="{$empno}" size="8" style="background: #e2e2e2" readonly="readonly"> <input type="text" name="NAME" value="{$fullname}" style="background: #e2e2e2" readonly="readonly" size="35"> <input type="text" name="LOAN" value="{$LOAN}" size="9"> <input type="text" name="AMOR" value="{$AMOR}" size="9"> <input type="button" name="add" value="ADD" onclick="SSSAdd()"> <input type="hidden" name="dateprocess" value="{$dateprocess"> </p> </legend> </fieldset> <div style="overflow:auto; height:300px; width:auto;"> <p> <table border="1" class="stat"> <tr> <td colspan="4" style="text-align:center">SSS ID</td> <td colspan="4" style="text-align:center">EMP ID</td> <td colspan="15" style="text-align:center">NAME</td> <td colspan="4" style="text-align:center">LOAN</td> <td colspan="4" style="text-align:center">DEDUCTION</td> <td colspan="4" style="text-align:center">DATE PROCESS</td> </tr> {section name=att loop=$getsss} <tr> <td colspan="4" style="background: #e2e2e2" readonly="readonly">{$getsss[att].SSS}</td> <td colspan="4" style="background: #e2e2e2" readonly="readonly">{$getsss[att].EMP_NO}</td> <td colspan="15" style="background: #e2e2e2" readonly="readonly">{$getsss[att].FULLNAME}</td> <td colspan="4" style="background: #e2e2e2" readonly="readonly">{$getsss[att].SSSLoan}</td> <td colspan="4" style="background: #e2e2e2" readonly="readonly">{$getsss[att].SSSAmor}</td> <td colspan="4" style="background: #e2e2e2" readonly="readonly" id="dateprocess" onclick="editloan('{$getsss[att].DATE_PROCESS}')">{$getsss[att].DATE_PROCESS}</td> </tr> {sectionelse} <tr><td colspan="1">No DATA</td></tr> {/section} </table> <table border="1"> <tr> <td colspan="4" style="text-align:center"><b>TOTAL:</b></td> <td colspan="5" style="background: #e2e2e2" readonly="readonly">{$Total_Loan}</td> </tr> </table> </p> </form> </div> </div> Code: [Select] <?php include 'config.php'; $currentEmpID = $_SESSION['empID']; $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') AS FULLNAME, SSS, HDMF, TIN FROM PERSONAL WHERE EMP_ID='$currentEmpID'"; $recPersonal = $conn->Execute($sql); if (!$recPersonal) { print $conn->ErrorMsg(); } if (!$recPersonal->BOF) { $recPersonal->MoveFirst(); } $sss = trim($recPersonal->fields['SSS']); $hdmf = trim($recPersonal->fields['HDMF']); $tin = trim($recPersonal->fields['TIN']); $smarty->assign('sss', $sss); $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME FROM PERSONAL ORDER BY LNAME ASC"; $recPersonalNav = $conn->GetAll($sql); $smarty->assign('personalAll', $recPersonalNav); // ======================================================================================================================== $sql = "SELECT em.EMP_NO, p.EMP_ID, CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') AS FULLNAME FROM PERSONAL p, EMPLOYMENT em WHERE p.EMP_ID='$currentEmpID' AND em.EMP_ID = '$currentEmpID'"; $recPersonalHead = $conn->Execute($sql); $fullName = $recPersonalHead->fields["FULLNAME"]; $empno = $recPersonalHead->fields["EMP_NO"]; $smarty->assign('empid', $currentEmpID); $smarty->assign('fullname', $fullName); $smarty->assign('empno', $empno); //===============================SELECT SSSLoan=================================== $dateprocess = $_GET['dateprocess']; $sql = "SELECT s.EMP_NO, s.SSSLoan, s.SSSAmor, s.DATE_PROCESS FROM $PAYROLL.sssloan s, $ADODB_DB.employment em WHERE em.EMP_NO= s.EMP_NO AND s.DATE_PROCESS = '$dateprocess'"; $rsloan = $conn2->Execute($sql); $LOAN = trim($rsloan->fields['SSSLoan']); $AMOR = trim($rsloan->fields['SSSAmor']); $dateprocess = $rsloan->fields['DATE_PROCESS'] ; $smarty->assign('LOAN', $LOAN); $smarty->assign('AMOR', $AMOR); $smarty->assign('dateprocess', $dateprocess); //============================SELECT ALL DATA FOR SSSLOAN========================== $sql = "SELECT s.EMP_NO, em.EMP_ID, p.SSS, CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') AS FULLNAME, s.SSSLoan, s.SSSAmor, s.DATE_PROCESS FROM $ADODB_DB.PERSONAL p, $ADODB_DB.employment em, $PAYROLL.sssloan s WHERE s.EMP_NO = em.EMP_NO AND p.EMP_ID = '$currentEmpID' AND em.EMP_ID = '$currentEmpID'"; $rs = $conn2->GetAll($sql); $smarty->assign('getsss', $rs); $sql = "SELECT s.EMP_NO, SUM(SSSAmor) AS Total_Loan FROM $PAYROLL.sssloan s, $ADODB_DB.employment em WHERE em.EMP_NO = s.EMP_NO AND em.EMP_ID = '$currentEmpID'" or die (mysql_error()); $rsTotal = $conn2->Execute($sql); $Total_Loan = $rsTotal->fields['Total_Loan']; $smarty->assign('Total_Loan', $Total_Loan); $smarty->display('header.tpl'); $smarty->display('loanForm.tpl'); $smarty->display('footer.tpl'); exit(); ?> when I click date in <td colspan="4" style="background: #e2e2e2" readonly="readonly" id="dateprocess" onclick="editloan('{$getsss[att].DATE_PROCESS}')">{$getsss[att].DATE_PROCESS}</td> it result no value...it did not get the value that I click Thank you in advance Similar TutorialsHi all, Im trying something which when a User clicks on there Rep they have it displays all the ranks, but on the same page, so far ive got this: <?php $view_rep = $_GET['repview']; $thererep = $fetch->rep; if (strip_tags($view_rep)){ echo ("<table align='center' class='table' border='1' cellpadding='0' cellspacing='0' width='50%'> <tr> <td class='header' align='center'>Your Rep</td> </tr> <tr> <td>You Currently Have: ".makecomma($thererep)."</td> </tr> </table>"); } ?> <font color='#000055'>Rep:</font> <a href='?repview' target='mainFrame'><?php echo("".makecomma($fetch->rep).""); ?></a> (I haven't finished the whole echo(""); part yet as I was just testing it before I got to far.) But when the click the Rep link it just shows there full stats instaid just the Rep. Is anyone able to put me in the right direction on sorting this? Thanks. First of All hello to all I have done registration login script and when I starting to making the users profiles, I have problem in the $_GET function well this is the code <?php $getid = $_GET['id']; if (!$getid) $getid = "1"; require('scripts/connect.php'); $query = mysql_query("SELECT * FROM users WHERE id='$getid'"); mysql_real_escape_string; $numrows = mysql_num_rows($query); if ($numrows == 1){ $row = mysql_fetch_assoc($query); $id = $row['id']; $firstname = $row['first_name']; $lastname = $row['last_name']; $user = $row['username']; $avatar = $row['avatar']; $city = $row['city']; echo "<div id='profile'> <div id='leftside'> <a href='profile.php?$user'><img src='avatars/$avatar' width='100px' height='100px' border='0'</a></img><br /><a href='profile.php?$user'>$firstname $lastname <br />($user)<br /></a>$city <br /></div>"; } else echo " You have to contact administrator"; ?> When I login as user id 1 then it display all right but when I go and login as another user it display the first users piture, name, surname & city can someone tell me what the problem is ? I know is this if (!$getid) $getid = "1"; but why is this happen If someone tell me or point to the right direction I would be thank full if i got some homepage named index.php and got a $_GET function which calls index.php?strana=2, how do i define so my index.php or just www.example.com/folder/ is same like index.php?strana. Cuz Ive got 2 forms on my website and when i put index.php?strana - i get the first one, when i put index.php?strana=2 - i get the second one but when i put index.php only or blank as i said above im still getting second form Okay im trying to make it so when some is on this link ("?serv=del&id=$ID") it displays a portlet of a yes/no form. onces yes/no is picked it goes to ("?serv=del&id=$ID&del=true"). I have no idea if im doing this right or if theres a better way of doing it. But trying to fix this problem has almost made me throw my computer threw my window. Thanks in advanced. <?php if(isset($_GET['serv']) && $_GET['id'] == $serverid && $_GET['del'] == 'true') { if($_POST['ture']) { mysql_query("DELETE FROM `notifications` WHERE `id`='$msgid'"); Echo "<center>Message Deleted</center>"; } else { Echo "<center>Message delete request has been canceled.</center>"; } } elseif(isset($_GET['serv']) && $_GET['id'] == $serverid) { ?> <div class="usercp_body"><!-- UserCP Notification Manage Start --> <div id="dash_chart" class="portlet" style="width:100%;margin: 0 auto;"> <div class="portlet-header"> <h4><center>All Servers For <?php echo $username; ?></center></h4> </div> <div class="portlet-content"> <form action="manage.php?serv=del&id=<?php echo $serverid; ?>&del=true" method="post"> <input type="submit" class="bgbtn blue" value="Yes" name="true" /> <input type="submit" class="bgbtn blue" value="No" name="false" /> </form> </div> </div> </div> <?php } ?> I get an error saying call to undefined function. Shouldn't move_uploaded_file() work? (I know I didn't set the size and etc, it's just a practice test) Also, my host's php version is 4.4.9 could that be a problem? <?php session_start(); include "functions.php"; include "database.php"; if(($_POST['upload'])){ $uploadname = $_FILES['avatar']['name']; $tmp_name = $_FILES['avatar']['tmp_name']; if($uploadname){ echo "..."; } else{ die("Please select a file numb nuts!"); } if($uploadname) { $location = "avatars/$name"; move_uploaded_file($tmp_name,"$location"); $query = mysql_query("UPDATE narutorpg SET imagelocation = '$location' WHERE username = '$name'"); $die("Your avatar is uploaded. <a href = 'character.php'> home </a>"); } } echo " <form action = '' method = 'POST' enctype = 'multipart/form-data'> File:<input type = 'file' name = 'avatar'> <input type = 'submit' name = 'upload' Value = 'upload'> </form>"; ?> Code: [Select] <html> <center> <form method="post" action=""> <b>Email</b><br><input type="text" name="email"/><br> <b>Password</b><br><input type="password" name="password"/><br> <input type="submit" name="submit" value="Login"/><br> </form> <?php if(isset($_POST['submit'])){ echo echo_post($_POST['email']); function echo_post($postvar){ return $postvar; } } ?> </center> </html> the filename is index.php How come I get the undefined function echo_post on line 14? I know it is probably something simple but I am kind of new to this, if you could help me out that would be great Hi all I have been trying to do a query but I get Call to undefined function mysql_connect() What other way can I perform a query? Or do I need to get something enabled? Thank in advance Dave Good day! I change my database from sql yog to SQL Server 2005 Express so in php the connection is different, so now I am new in SQL Server 2005 Express. i edit my login page and I encountered error: Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\web_intranet\index.php on line 14 here is my code: <?php session_start(); session_regenerate_id(); if($_SESSION['loggedin']){ //the user is already logged in, lets redirect them to the other page header("Location:company.php"); } //require_once 'conn.php'; $server = "PDOMAIN\MSFW"; $db_name="dspi"; mssql_connect($server) or die("Cannot connect to server"); mssql_select_db("$db_name")or die("Cannot select DB"); $department = $_POST['department']; $username = $_POST['username']; $sql=mssql_query("SELECT `Department`, `Username` FROM `tbllogin` WHERE `Department` = '{$department}' AND Username = '{$username}'") or die(mssql_min_error_severity()); $ct = mssql_num_rows($sql); if($ct == 1) { // im guessing this means that the user is valid. $_SESSION['loggedin'] = true; // now that the user is valid we change the session value. $row = mssql_fetch_assoc($sql); //$_SESSION['username'] = $row['Username'] ; //$_SESSION['department'] = $row['Department']; $Departments=array('Accounting', 'Engineering', 'Finishing_Goods', 'HRAD', 'MIS', 'Packaging_and_Design', 'Production', 'Purchasing_Logistic', 'QA_and_Technical', 'Supply_Chain'); if (in_array($row['Department'], $Departments)){ header ('Location:company.php'); }else{ echo "Incorrect Username or Department"; header ('Location:index.php'); } } ?> //$_SESSION['department'] = $row['Department']; $Departments=array('Accounting', 'Engineering', 'Finishing_Goods', 'HRAD', 'MIS', 'Packaging_and_Design', 'Production', 'Purchasing_Logistic', 'QA_and_Technical', 'Supply_Chain'); if (in_array($row['Department'], $Departments)){ header ('Location:company.php'); }else{ echo "Incorrect Username or Department"; header ('Location:index.php'); } } ?> i already enable extension mssql in php.ini When I click on this span I want it to alert the ID if the span...
<span id='" . $thisid . "' onClick='likeThis()'><img src='https://cdn1.iconfinder.com/data/icons/nuvola2/32x32/apps/amor.png'>Like</center></span> <script> function likeThis(){ var lb = $(this).attr('id'); alert(lb) } </script>However, it currently just says 'undefined'. What's wrong? Thanks, Currently, I am reading a book called PHP Web 2.0 Mashups and I have stumbled across an error on the second chapter which deals with XML-RPC protocol. The book has the following code which it uses to demonstrate the XML-RPC encoding functionality of PHP with the xmlrpc_encode_request function: <?php $singleVar = "Hello!"; $requestMessage = xmlrpc_encode_request('theRemoteCall', $singleVar); echo $requestMessage; ?> However when I load this page up on my local testing platform nothing is displayed. Upon checking the PHP error log I am confronted with this: [24-Jan-2011 07:56:40] PHP Fatal error: Call to undefined function xmlrpc_encode_request() in C:\wamp\www\jquery\collapsible.php on line 79 A couple of other points in relation to this: 1. I have the following lines in my PHP.ini file: Code: [Select] ; Turn off normal error reporting and emit XML-RPC error XML ; http://php.net/xmlrpc-errors ;xmlrpc_errors = 0 ; An XML-RPC faultCode ;xmlrpc_error_number = 0 Does this not mean that xmlrpc functions are all ready installed on my WAMP server? I have download XML-RPC for PHP from http://phpxmlrpc.sourceforge.net/ (3.0.0 beta) and placed the files inside the extracted 'lib' folder into C:/PHP/includes and uncommented the PHP.ini line 'include_path = ".;c:\php\includes"'. However still, after restarting WAMP and refreshing the page it is still issuing a fatal error in PHP error log. Thank you for all your help in advance. PHP Version 4.4.9 Fatal error: Call to undefined function: date_default_timezone_set() in /hsphere/local/home/xxxxx/addfeeds2.php on line 11 can sombady help me how to fix this please? can't upgrade php version line 11 is date_default_timezone_set("Europe/Rome"); What's undefined about deposit()? Code: [Select] class BankAccount { private $name; var $balance = 0; private $dep = 0; function __construct() { if (array_key_exists ("deposit" , $_POST)) { $dep = $_POST['deposit']; echo $dep; deposit($dep); } } function deposit($dep) { $balance += $dep; echo $balance; } } Error: call to undefined function mcrypt_module_open() I have copied this code form net. And i think so that mcrypt_module_open() would be a built in function. But I think it is not so. How can i define this function. OR any other way to solve this problem?? Code: [Select] $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); $iv_size = mcrypt_enc_get_iv_size($cipher); printf("iv_size = %d\n",$iv_size); $key256 = '12345678901234561234567890123456'; $key128 = '1234567890123456'; $iv = '1234567890123456'; printf("iv: %s\n",bin2hex($iv)); printf("key256: %s\n",bin2hex($key256)); printf("key128: %s\n",bin2hex($key128)); $cleartext = 'The quick brown fox jumped over the lazy dog'; printf("plainText: %s\n\n",$cleartext); if (mcrypt_generic_init($cipher, $key256, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher,$cleartext ); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("256-bit encrypted result:\n%s\n\n",bin2hex($cipherText)); } if (mcrypt_generic_init($cipher, $key128, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher,$cleartext ); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("128-bit encrypted result:\n%s\n\n",bin2hex($cipherText)); }Thanks In advance Something strange is happning, line producing the error: if( ($this->subject == "") || ($this->message == "") ){ Any ideas guys? thanks lots!! I have this code that has Code: [Select] $this->BeginTransaction();all over it. These are in classes where no such function is defined, and they don't have parents either. It's driving my crazy trying to figure out why they are there, why there's not so much as a warning being given and what, if anything, is being called. Now I do have a Code: [Select] set_error_handler("amfErrorHandler");and in amfErrorHandler I have Code: [Select] if( error_reporting() != 0 && ($amfphpErrorLevel | $level) == $amfphpErrorLevel ) { throw new VerboseException($string, $level, $file, $line); } I don't remember what $amfphpErrorLevel is, except that it should only be ignoring things like E_STRICT. Also, no exception is being thrown. So what do I do w/this code? A few months ago, and a good amount of time before that, I had people telling me to use isset() instead of performing to see if the variable is empty, such as: !$_GET[''] I know the differences in the function and what they do, but when could isset() be used in a situation where it's better/more efficient then: !$_GET[''] I do use isset(), though. |