PHP - Call Php Output In Js?
Hello , <script>ex.ui{"name": "<?php echo for ( esc_attr ( get_option ( 'sclm ) ) ); ?>",}</script>
like above script. I want that script in js, and that php code will be fetch the value in js. so please help me about that. Thanks Edited April 18, 2019 by Ishangarg61Similar TutorialsOVERVIEW: The code is about making call to the escreen web service using SOAP and Curl with client authentication required. Currently I am not getting any result only HTTP 403 and 500 errors. The call requires client authenticate cert to be on the callng site. CODE: $content = "<TicketRequest> <Version>1.0</Version> <Mode>Test</Mode> <CommitAction></CommitAction> <PartnerInfo> <UserName>xxxxxxxxxx</UserName> <Password>xxxxxxxxxxx</Password> </ PartnerInfo> <RequestorOrderID></RequestorOrderID> <CustomerIdentification> <IPAddress></IPAddress> <ClientAccount>xxxxxxxxxx</ClientAccount> <ClientSubAccount>xxxxxxxxxx</ClientSubAccount> <InternalAccount></InternalAccount> <ElectronicClientID></ElectronicClientID> </CustomerIdentification> <TicketAction> <Type></Type> <Params> <Param> <ID>4646</ID> <Value></Value> </Param> </Params> </TicketAction> </TicketRequest>"; $wsdl = "https://services.escreen.com/SingleSignOnStage/SingleSignOn.asmx"; $headers = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", // "SOAPAction: \"\"", "Content-length: ".strlen($content), ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $wsdl); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_VERBOSE, '1'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $content); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '1'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '1'); //curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //curl_setopt($ch, CURLOPT_HTTPHEADER, array('SOAPAction: ""')); curl_setopt($ch, CURLOPT_CAPATH, '/home/pps/'); curl_setopt($ch, CURLOPT_CAINFO, '/home/pps/authority.pem'); curl_setopt($ch, CURLOPT_SSLCERT, 'PROTPLUSSOL_SSO.pem'); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'xxxxxxxxxxxx'); $output = curl_exec($ch); // Check if any error occured if(curl_errno($ch)) { echo 'Error no : '.curl_errno($ch).' Curl error: ' . curl_error($ch); } print_r($output); QUESTIONS: 1. I need to call the RequestTicket method and pass the XML string to it. I don't know how to do it here(pass the method name to call). 2. For client authentication they gave us three certs, one root cert, one intermediate cert and a client authentication cert PROTPLUSSOL_SSOpem(it was a .pfx file). Since we are on linux we converted them to pem . In curl calls I could not find way to how to include both the root cert and the intermediate cert ,so I combined them by making a new pem file and copying the intermediate cert and them the root cert and naming it authority.pem . I am not sure whether it works or not and would like your opinion. 3. For the current code Iam getting the error Error no : 77 Curl error: error setting certificate verify locations: CAfile: /home/pps/authority.pem CApath: /home/pps/ If I disable the curl error message,I am getting blank page with page title 403 - Forbidden. Access is denied. If I comment out the CURLOPT_CAPATH and CURLOPT_CAINFO lines it gives http 500 error page with the message as content and the following at the top. > HTTP/1.1 500 Internal Server Error. Cache-Control: private Content-Type: text/html Server: Microsoft-IIS/7.5 X-AspNet-Version: 1.1.4322 X-Powered-By: ASP.NET Date: Thu, 02 Sep 2010 14:46:38 GMT Content-Length: 1208 If I comment out as above and also CURLOPT_SSLCERT and CURLOPT_SSLCERTPASSWD it gives 403 error with the message as content. So I would request you to help me out by pointing out whats wrong with the current code. Thank you. This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=319682.0 I can call the following function successfully as a single php program // Acknowledge and clear the orders function ack($client, $merchant, $id) { $docs = array('string' => $id); $params = array('merchant' => $merchant, 'documentIdentifierArray' => $docs); $result = $client->call('postDocumentDownloadAck', $params); return $result; } with $result = ack($t, $merchant,'2779540483'); successful output [documentDownloadAckProcessingStatus] => _SUCCESSFUL_ [documentID] => 2779540483 I'm trying to figure out how to call this function as an object from another program. Trying the following gives error ***Call to a member function call() on a non-object*** function postDocumentDownloadAck($t, $merchant, $id) { $this->error = null; $docs = array('string' => $this->id); $params = array('merchant' => $this->merchant, 'documentIdentifierArray' => $docs); ** I've tried the following which does nothing $result = $this->soap->call('postDocumentDownloadAck', $params); ** I've tried the following - which gives error "Call to a member function call() on a non-object" $result = $this->t->soap->call('postDocumentDownloadAck', $params); if($this->soap->fault) { $this->error = $result; return false; } return $result; } *** calling program snippet for above function $merchant= array( "merchant"=> $merchantid, "merchantName" => $merchantname, "email"=> $login, "password"=> $password); $t = new AmazonMerchantAPI($merchantid, $merchantname, $login, $password); $documentlist= $t->GetAllPendingDocumentInfo('_GET_ORDERS_DATA_'); $docid = $documentlist['MerchantDocumentInfo'][$i]['documentID']; $docs = array('string' => $docid); $ackorders = $t->postDocumentDownloadAck($t, $merchant,$docs); Any ideas of what I'm doing wrong are greatly appreciated. Well I have a script that executes a scan on a system set to run infinitely, and I need it to echo out a message each time it loops through, but I don't want it to echo out the message with the next loop message below it, and the next one below that etc... I've tried using the flush(); function and been messing around with that with no luck. For security reasons I don't want to release any of the processing code, but here is the basic construction of the script: <?PHP ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $RepeatIt = -1; for($g=1; $g!=$RepeatIt+1; $g++) { ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $ScanMessage = ":.:.: SCANNING THE HITLIST FOR MOBSTER: ".$MobName." (SCAN #$g) :.:.:"."<br/><br/>"; echo $ScanMessage; ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** } ?> At the moment it's returning: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #1) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #2) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #3) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #4) :.:.: So what I want it to do is just delete the scanning message and replace it with the next scan message so while running this script you would see just the number increment on the same line. Any suggestions? Thanks. Hello, I've been trying this for hours now, looking at different examples and trying to change them to work for me, but with no luck... This is what I am trying to do: I have a simple form with: - 1 input field, where I can enter a number - 1 Submit Button When I enter a number into the field and click submit, I want that number to be send to the php file that is in the ajax call, then the script will take that number and run a bunch of queries and then return a new number. I want that new number to be used to call the php script via ajax again, until no number is returned, or something else is returned like the word "done" or something like that, at which point is simply makes an alert or populated a div with a message... The point is, that depending on the number entered it could take up to an hour to complete ALL the queries, so I want the script that is called to only run a fixed amount of queries at a time and then return the number it is currently at (+1), so that it can continue with the next number when it is called again. I would like to use jquery, but could also be any other way, as long as I get this to work. I already have the php script completed that needs to be called by the ajax, it returns a single number when being called. Thank you, vb I have created a form and the .php file that collects the selected data. What I cannot seem to find out is the code to put into the process.php to retrieve information from my sql db that a crawler retrieved.
Form
<form action="process.php" method="post"> Game: <select name="game"> <option>Select a Game</option> <option>Counter-Strike 1.3</option> <option>Counter-Strike: Source</option> <option>Counter-Strike: GO</option> <option>ArmA: 3</option> <option>Call Of Duty: 4</option> </select> Slots <select name="game"> <option>Desired Slots</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> </select> <input type="submit" /> </form>Process.php <?php $quantity = $_POST['quantity']; $item = $_POST['item']; echo "You are looking for a ". $game . " server with " . $slots . " slots.<br />"; echo "We are processing your request!"; ?>I am looking for it to be out putted into a nice table as such <TR> <TH><font color="red"><b>Company</B></font></TH> <TH><font color="red"><b>Slots</B></font></TH> <TH><font color="red"><b>Pricing</B></font></TH> </TR> <TR ALIGN="CENTER"> <TD>$company</TD> <TD>$slots</TD> <TD>$price</TD> </TR>Thanks for your assistance! Trying to hook up to an API using php. The API commands are sent in url query strings. Depending on the command you are sending in the query string, the API returns an XML file or text. For commands that return an XML file I can use $response=simplexml_load_file($APIcall) and parse and store the xml that comes back into $response. But with text responses from the API I cannot find a way to handle the reply. Using xml_load_file() results in errors displayed since it was expecting xml and nothing gets stored in $response, although the command is correctly executed by the API. I can use headers('Location: $APIcall') but that just gets the text response sent to a new window. $response=get_headers($APIcall) works for some commands but still does not capture the text response. Hi,
I'm trying to combine the two codes below so that my images can be styled by CSS?
echo '<img src="' . get_stylesheet_directory_uri() . '/images/category-two.png' . '" alt="Your Alt Text" />'; array( 'class' => 'alignleft' )Thanks for your time. Hi im new to php Im excellent in C# more but lets not go into that I was wondering how to call this function. What am i doing wrong.. <?php if(isset($_POST['submit'])) { $startDate = strtotime($_POST['startdate']); $endDate = strtotime($_POST['enddate']); if($startDate != false && $endDate != false) { $startDate = date("y-m-d",$startDate); $endDate = date('y-m-d',$endDate); SearchForBookedRooms($startDate,$endDate); } else { echo "Please select both dates!"; } function SearchForBookedRooms($startDate,$endDate)//Calling this Function Here?? { } } ?> $y is my variable that I increment by a for loop. This variable determines the number of every row ..and then i'd concat'd $y with the name of the textboxes of every column and row name="orno<?php echo $y;?>" now, i'm not sure if i'm supposed to concat with the name or should it be with the id? HOW DO i CALL THE NAME FROM ANOTHER PAGE? this is what I did and I don't know if this is right $orno= $_POST['orno'.$y]; and since I know I may not be making much sense with my explaination above, this is my add_content.php where it all starts I've only included the part where the textboxes are displayed by/within a loop and where the names are concatenated with the variable $y. I have dropdowns and textboxes for the date and other elements above this. <div id="slider"> <ul> <?php $num=$_GET['num'];//this here represents the number of rows //of textboxes user wants to appear //there are 5 textboxes in one row and 10 rows in one page //this is a sliding page with jquery $nump=$num / 10; $y=1;//initializing y for($j=1;$j<=$nump;$j++){//determines how many pages then loops accordingly ?> <li> <p> <?php for($i=1;$i<=10;$i++){//loops 10 times to return 10 rows in a pages if(strlen($y)==1){ echo "0"; } echo $y." "; ?> <input name="orno<?php echo $y;?>" id="orno" type="text" size="3" maxlength="6" onKeyPress="return isNumberKey (event)" value="<?php if (isset($_POST['orno'])) { echo htmlspecialchars($_POST['orno'], ENT_QUOTES); }?>"> <input name="billnmbr<?php echo $y;?>" id="billnmbr" type="text" size="16" maxlength="17" value="<?php if (isset($_POST['billnmbr'])) { echo htmlspecialchars($_POST['billnmbr'], ENT_QUOTES); }?>"> <input name="payor<?php echo $y;?>" id="payor" type="text" size="35" maxlength="50" value="<?php if (isset($_POST['payor'])) { echo htmlspecialchars($_POST['payor'], ENT_QUOTES); }?>"> <input name="arrastre<?php echo $y;?>" id="arrastre" type="text" size="7" maxlength="8" onKeyPress="return isMoneyKey (event)" value="<?php if (isset($_POST['arrastre'])) { echo htmlspecialchars($_POST['arrastre'], ENT_QUOTES); }?>"> <input name="wharfage<?php echo $y;?>" id="wharfage" type="text" size="7" maxlength="8" onKeyPress="return isMoneyKey (event)" value="<?php if (isset($_POST['wharfage'])) { echo htmlspecialchars($_POST['wharfage'], ENT_QUOTES); }?>"><br /> <?php $y++; }?> </p> </li> <?php $y=$y; } ?> </ul> </div> then we go to add_save.php this page is still very lacking because I don't know how to evaluate then save multiple rows yet since I've originally done a page that saves one row at a time in which the textboxes' names aren't from a loop and were not concatenated. <?php //please take a look at how I am calling the $_POSTs from the prev page //what is the right way of calling concatenated names? //or if there is a better way of calling these please let me know.. $year=$_POST['year']; $month=$_POST['month']; $day=$_POST['day']; $date=$year."-".$month."-".$day; $billnmbr=$_POST['billnmbr'.$y]; $orno= $_POST['orno'.$y]; $payor=$_POST['payor'.$y]; $arrastre=$_POST['arrastre'.$y]; $wharfage=$_POST['wharfage'.$y]; $total=$arrastre + $wharfage; $tcl=$_POST['tcl']; $preparedby=$_POST['preparedby']; $notedby=$_POST['notedby']; $addedby=$_POST['addedby']; $office=$_POST['office']; if($_POST['btnadd']){ if($billnmbr=="" or $orno=="" or $payor=="" or $arrastre=="" or $wharfage=="" or $year=="" or $month=="" or $day=="" or $tcl=="" or $preparedby=="" or $notedby=="" or $addedby=="" or $date=='2010-01-01'){ ?> <script> alert ('At least one field was left blank!'); </script> <?php } else{ $query = mysql_query("select * from `arrastre` WHERE `billnmbr`='$billnmbr'"); $count = mysql_num_rows($query); if($count==1){//existing billnmbr echo "This billnumber is already in the database."; } else{ $bll = strtoupper($billnmbr); $explode_bill=explode("-",$bll); $bill1 = 0; $bill2 = 0; $bill1 = $explode_bill[0]; $bill2 = $explode_bill[1]; if(strlen($bill2)<6 && strlen($bll)!=17){ if(strlen($bill2)==1){ $rep = "00000"; $bll = $bill1."-".$rep."".$bill2; } elseif(strlen($bill2)==2){ $rep = "0000"; $bll = $bill1."-".$rep."".$bill2; } elseif(strlen($bill2)==3){ $rep = "000"; $bll = $bill1."-".$rep."".$bill2; } elseif(strlen($bill2)==4){ $rep = "00"; $bll = $bill1."-".$rep."".$bill2; } elseif(strlen($bill2)==5){ $rep = "0"; $bll = $bill1."-".$rep."".$bill2; } } $payr = strtoupper($payor); $query="insert into `arrastre` values ('0', '$orno', '$bll','$payr', '$arrastre', '$wharfage', '$total', '$date', '$tcl', '$preparedby', '$notedby', '$addedby', '$office')"; $result=mysql_query($query); ?> <?php }}} ?> thank you very much Hello, I was wondering how I can call another web page. I don't want to read the page I just need to send it information like test.php?action=this I don't need to read or store I just need to pass it info so it can handle some site changes on the other site. Thanks in advance! Hello, I am trying to understand how to post several actions and return 1 call. I am new to this so I thank you for your understanding. Here is the full story, I have the Jquery working now that 1 "onSelect" will post to 6 php files, but it takes forever for all the calls to return to the div. From my reading, I need to put the 6 php files into one php file, and then return this with JSON... here is where my trouble begins. Now here is the current php file that I have put into 1 php file (placed as they were working when in 6 files to the Jquery below) <?php $choice = (isset($_POST['choice'])) ? date("Y-m-d",strtotime($_POST['choice'])) : date("Y-m-d"); $con = mysql_connect("xxxxxx","xxxxxx","xxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("inverters", $con); $sql = "SELECT sum(power/1000) AS choice FROM feed WHERE date = '".$dayPower."' group by date";$res = mysql_query($sql) or die('sql='.$sql."\n".mysql_error()); $d = array(); while($row = mysql_fetch_assoc($res)) {; echo json_encode($d); } ?> <?php $choice = (isset($_POST['choice'])) ? date("Y-m-d",strtotime($_POST['choice'])) : date("Y-m-d"); $con =$con = mysql_connect("xxxxxx","xxxxxx","xxxxxx"); mysql_connect("localhost","root","mackie1604"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("inverters", $con); $sql = " SELECT HOUR(time) as h, power FROM feed WHERE date = '".$choice."' ORDER BY HOUR(time)"; $res = mysql_query($sql) or die('sql='.$sql."\n".mysql_error()); $daypower = array(); while($row = mysql_fetch_assoc($res)) { $daypower[] = $row['power']; } ?> <script type="text/javascript"> $(document).ready(function() { var chart = new Highcharts.Chart({ chart: { renderTo: 'apDiv4', defaultSeriesType: "column", }, events: { marginTop: 1, marginRight: 1, marginBottom: 1, marginLeft: 4 }, credits: { enabled: false, }, title: { text: null, }, subtitle: { text: null, }, xAxis: { labels: { y: 15 }, categories: ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'] }, yAxis: { min: 0, max: 2000, title: { text: null }, labels: { align: 'left' } }, legend: { enabled: false }, tooltip: { formatter: function() { return ''+ this.x +': '+ this.y +' Watt hr'; } }, plotOptions: { column: { pointPadding: 0.02, borderWidth: 0 } }, series: [{ name: '', color: '#50B432', data: [<?php echo join($daypower, ', '); ?>] }] }); }); </script> <?php $choice = (isset($_POST['choice'])) ? date("m",strtotime($_POST['choice'])) : date("m"); $con = mysql_connect("xxxxxx","xxxxxx","xxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("inverters", $con); $sql = "SELECT sum(power/1000) AS choice FROM feed WHERE month(date) = '".$choice."'"; $res = mysql_query($sql) or die('sql='.$sql."\n".mysql_error()); $row = mysql_fetch_assoc($res); echo $row['choice'].'<br />'; ?> <?php $choice = (isset($_POST['choice'])) ? date("m",strtotime($_POST['choice'])) : date("m"); $con = mysql_connect("xxxxxx","xxxxxx","xxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("inverters", $con); $sql = " SELECT MONTH(date) AS m, SUM(power/1000) AS monthpower FROM feed WHERE MONTH(date) = '".$choice."' GROUP BY DAY(date) ORDER BY DAY(date)"; $res = mysql_query($sql) or die('sql='.$sql."\n".mysql_error()); $monthpower = array(); while($row = mysql_fetch_assoc($res)) { $monthpower[] = $row['monthpower']; } ?> <script type="text/javascript"> $(document).ready(function() { var chart = new Highcharts.Chart({ chart: { renderTo: 'apDiv9', defaultSeriesType: "column" }, events: { marginTop: 1, marginRight: 0, marginBottom: 0, marginLeft: 1 }, title: { text: null, }, subtitle: { text: null, }, xAxis: { labels: { y: 15 }, categories: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'] }, yAxis: { min: 0, max: 20, title: { text: null }, labels: { align: 'left' } }, legend: { enabled:false }, tooltip: { formatter: function() { return ''+ this.x +': '+ this.y +' kWh'; fontWeight: 'normal' fontSize: '1px' } }, plotOptions: { column: { pointPadding: 0.2, borderWidth: 0 } }, series: [{ name: '', color: '#50B432', data: [<?php echo join($monthpower, ', '); ?>] }], credits: { enabled:false, }, }); }); </script> <?php $choice = (isset($_POST['choice'])) ? date("Y",strtotime($_POST['choice'])) : date("Y"); $con = mysql_connect("xxxxxx","xxxxxx","xxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("inverters", $con); $sql = "SELECT sum(power/1000) AS choice FROM feed WHERE year(date) = '".$choice."'"; $res = mysql_query($sql) or die('sql='.$sql."\n".mysql_error()); $row = mysql_fetch_assoc($res); echo $row['choice3'].'<br />'; ?> <?php $choice = (isset($_POST['choice'])) ? date("Y",strtotime($_POST['choice'])) : date("Y"); $con = mysql_connect("xxxxxx","xxxxxx","xxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("inverters", $con); $sql = " SELECT MONTH(date) AS y, SUM(power/1000) AS yearpower FROM feed WHERE YEAR(date) = '".$choice."' GROUP BY MONTH(date) ORDER BY MONTH(date)"; $res = mysql_query($sql) or die('sql='.$sql."\n".mysql_error()); $yearpower = array(); while($row = mysql_fetch_assoc($res)) { $yearpower[] = $row['yearpower']; } ?> <script type="text/javascript"> $(document).ready(function() { var chart = new Highcharts.Chart({ chart: { renderTo: 'apDiv10', defaultSeriesType: "column" }, events: { marginTop: 1, marginRight: 1, marginBottom: 1, marginLeft: 1 }, credits: { enabled: false, }, title: { text: null, }, subtitle: { text: null, }, xAxis: { labels: { y: 15 }, categories: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'] }, yAxis: { min: 0, max: 500, title: { text: null }, labels: { align: 'left' } }, legend: { enabled: false }, tooltip: { formatter: function() { return ''+ this.x +': '+ this.y +' kWh'; } }, plotOptions: { column: { pointPadding: 0.2, borderWidth: 0 } }, series: [{ name: '', color: '#50B432', data: [<?php echo join($yearpower, ', '); ?>] }] }); }); </script> Here is the Jquery that was working to send to the 6 different php files (to help you understand what my goal is... Code: [Select] $('#datepicker').datepicker({maxDate: 0, dateFormat: 'yy-mm-dd', onSelect: function(dateText) { var myDate = $(this).datepicker('getDate'); $('#apDiv1').html($.datepicker.formatDate('DD, d', myDate)); $('#apDiv5').html($.datepicker.formatDate('MM', myDate)); $('#apDiv7').html($.datepicker.formatDate('yy', myDate)); $('#apDiv2').load('dayPower.php', {choice: dateText}, function() { $(this).show(); }); $('#apDiv4').load('dayGraph.php', {choice: dateText}, function() { $(this).show(); }); $('#apDiv6').load('monthPower.php', {choice: dateText}, function() { $(this).show(); }); $('#apDiv9').load('monthGraph.php', {choice: dateText}, function() { $(this).show(); }); $('#apDiv8').load('yearPower.php', {choice: dateText}, function() { $(this).show(); }); $('#apDiv10').load('yearGraph.php', {choice: dateText}, function() { $(this).show(); }); }}); }); I am back to this as what I was changing became a mess, and I am starting from what was working.... How do I get JSON to send and return from the one PHP file. Thank You, Alan Hi all. Im trying to get a result on one of my pages where it says if a members is banned 1 or not 0, I cannt seem to get it to work. What i need is some code that says. get banned FROM usersgnet WHERE name = POST'name' Then print the banned i,.e 1 = YES 0 = NO Its just so i can tell if i have banned them or not. Thanks gnetuk Please help me in this guys....... I am using MVC model for my application . I am stuck with the ajax call. this is my controller application/controller/admin/index.php function getCity() { $city=$this->model->getCity(); foreach($this->city as $key => $value) { echo '<option>'.$value['name'].'</option>' ; } } this is my model application/model/admin_model.php public function getCity() { if($_POST['id']) { $cid=$_POST['id']; $sth = $this->db->prepare('SELECT id, name FROM unit WHERE cid= :cid'); $sth->execute(array(':cid' => $cid)); return $sth->fetchAll(); } } this is my view <form id="city" action="<../application/admin/regstr/" method="post"> Country <select name="country" class="country"> <option value="" selected="selected">--Select Taluka--</option> <option value="1">India</option> <option value="2">USA</option> <option value="3">China</option> </select> City <select name="city" class="city"> <option selected="selected">--Select City--</option> </select> <input type="submit" /> </form> and this is my javascript for Ajax $(document).ready(function() { $(".country").change(function() { var id=$(this).val(); var dataString = 'id='+ id; $.ajax ({ type: "POST", url: "admin/getCity", data: dataString, cache: false, success: function(html) { $(".city").html(html); } }); }); }); But I am not getting the output. I have tested it with firebug in response tab. Instead of getting only option values html code as output I am getting the whole HTML page content (i.e. content of view page admin/index.php. Please help me out. Is this even possible? I'm trying to call function nameGen from in the function nameGen but I just get an error saying cannot redeclare. I only want it to return $newName when it is not in the array $takenVals. can this only be done with another loop and a constant somewhere? Code: [Select] $newVarVals = array(); $takenVals = array(); $varCount = count($varArray); // contents are set else where and is fine for($i = 0 ; $i < $varCount; ++ $i) { function nameGen(&$varCount,&$takenVals){ $newName = rand(0,$varCount); if(in_array($newName,$takenVals)) { nameGen(&$varCount,&$takenVals); } else{ return $newName; } } $newName = nameGen(&$varCount,&$takenVals); $takenVals[] = $newName; $newNameToKeep = '$_'.$newName; $newVarVals[] = array('oldName' => $varArray[$i], 'newName' => $newNameToKeep); } error: Cannot redeclare nameGen() hi I have a problem with my code. Actually i want to make a dynamic page. for that i have a database from where i get data. I getting data dynamically at homepage & make a hyperlink there with html code. But in actual inner pages are not exists. I made a file there which is getting dynamic data also. All comparing data is put in redirect.html on server & also include that specific file as well................Main Problem is that i do not know from where to call redirect.php....because when a link is clicked server open that page & we redirect control to redirec.php....... Is there any possible solutions How can I call this from within php? Code: [Select] <a href="#" onclick="return false" onmousedown="javascript:SlideBox('what10');">this has to be within this: Code: [Select] echo "....."; okay in modlogs.php i have a function Code: [Select] <?php function modmenu($page) { ?> <dl><dt class="<?php if ($page == 'modlogs') echo '';else echo 'ust'; ?> LEFT" style='margin-left:5px'><a href='mlogs.php'><b>User Logs</b></a> </dt><dt class="<?php if ($page == 'modlogs1') echo '';else echo 'ust'; ?> LEFT"><a href="modlogs1.php">Topic/Forum Actions</a></dt> <dd> <?php } ?> in modlogs1.php i try to echo Code: [Select] modmenu('modlogs1'); to show the menu but i get unidentified function? lol isn't functions global wtf? Hi
I'm trying to get the layout like i want but it's not easy
I have this file
<?PHP require_once("./include/membersite_config.php"); if(!$fgmembersite->CheckLogin()) { $fgmembersite->RedirectToURL("login.php"); exit; } if(isset($_POST['submitted'])) { $fgmembersite->PesquisarPorDatas(); } ?> <div id='fg_membersite_content'> <div class="CSSTableGenerator" > //I want the result here </div> <br>I want the result of this $fgmembersite->PesquisarPorDatas(); in "//I want the result here" the r of my code, when the user use the "Pesquisar" button this fucntion is called but the result comes out of my css any help please?? Edited by alphasil, 04 December 2014 - 10:32 AM. Hi, I was asking for help with this elsewhere, but after a week no one was able to answer my question so I thought someone here might be able to shed some light on it. My original question was: "I have an action that instantiates an object, and that object instantiates a bunch of child objects, and so on. My question is, do I only have to set set_time_limit() once in the action, in order to have that rule propagate to the execution of all of its child objects, or do I also have to set this in each of the class files that it calls? I similarly need to set ignore_user_abort() which I haven't used before, and I have the same question for that." To clear up confusion about what I was asking, I clarified this way: "That the limit applies to the "script" is the ambiguity I'm confused about. Technically, the original file is one script, so you set the timeout for that. But when it instantiates and object whose class code is coming from another file, that's a different "script", so presumably it could have its own timeout. And that's what my question is. Does the time out value you set automatically propagate to every other file that file calls on, or is it isolated to that file? If you set a time limit of 100 seconds, but instantiated an object from class code in a different file and called a long running method in it, and that file had a different time out, say of 30 seconds, the execution time of the original file would be limited to 30 seconds and not 100." In sum, do functions like ignore_user_abort() and set_time_limit() automatically apply to all code in the files a particular "script" require_once()'s? Or would it have to be set in those files as well? I would just test myself to find out, but the method I would use to do that would be sleep() and that time isn't counted toward set_time_limit() so it won't work. Thanks very much for any clarification someone might be able to give. |