PHP - How Do I Call This From Another Page?
$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 Similar TutorialsHi all This is a new one for yas. I want people to send SMS /TXT from my site. I got the form working fine. but it re-directs to the site that povides the sms ?????? how do i call up the prosess automaticlay without diverting from my form/orSITE heres my code <?php if(isset($_POST['submit'])) { $name = $_POST['name']; $msg = $_POST['msg']; header("Location: https://www.smsfun.com.au/api/login.php?mobile=44775080062265&password=100256&send_to=$name&message=$msg&send=1"); echo "User Has submitted the form and entered this phoneNO : <b> $name </b>"; echo "<br>User Has submitted the form and entered this MESSAGE : <b> $msg </b>"; } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="text" name="name"><br> <input type="text" name="msg"><br> <input type="submit" name="submit" value="SEND"><br> </form> zthis works Im thinking mabee opening the page and closing it may need a scipt can anyone help all the best gnetuk. 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! Hey guys, I'm making an Ajax call to my database and retrieving a newsletters HTML code as the result. I then prepend it into a div area called code_content. I use some php str_replace to add some links also. When the content loads into the div, the user can then add further content to it via Ajax calls, appending articles and that. What I'm trying to figure out is how can I then retrieve all the newly edited contents of this code_content div soni can send it to my Ajax function to write to te db? I have a page that functions like this:
The user begins by loading ajaxtest.php, then using a drop-down menu, selects a user, after which a DIV on ajaxtest.php is populated with the user's selction to getuser.php?q=John%Doe
Here's a visual representation of what is currently happening, along with the part I don't understand.
getuser.php consists largely of a a large HTML table which interacts through PHP with my SQL database. Several of the fields in this table are editable, and after the user changes one of these fields, he can press an "update" button, which calls an AJAX script in update.js and runs update.php, which contains all my SQL queries to update the database, without the user being redirected to this update.php page. All of this is processing perfectly - the user makes some sort of edit, hits "update", and the database gets updated without any redirection or refresh.
Here's what I can't figure out though. Once the user makes a change, and hits "update," the database updates, but the end user doesn't see those changes that he made. I can't just do a simple page refresh, because the action is taking place on getuser.php, but getuser.php is loaded inside of a #DIV on ajaxtest.php. If I use something like window.location.reload(), this just refreshes ajaxtest.php and puts the user back to the starting point of having to select a user. This is not what I want. I don't want to refresh ajaxtest.php, I want to "refresh" ajaxtest.php with getuser.php?q=John%Doe insidethe DIV on ajaxtest.php.
It seems like this is very common - several forums have this capability, where a user has a page loaded, adds a comment, and sees that comment immediately without a full page refresh. I just don't know how to do it, and I've tried at lengths to search the web for an answer with no luck.
Can someone walk me through how to do this?
I have two pages one is db.php and another is form.php. In form.php i have created a form which contains different fields and a submit button. But i want to write the queries in db.php. And when i click on the submit button the insert query in db.php should be executed and insert data in database but the focus remains on form.php. How can i do this??? Any Idea? OVERVIEW: 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. I have page for checkout ( shopping cart) When person leaves a page I have a javascript called which gives alert Are you sure you want to leave this page? OK and Cancel button Which works fine However I donot want this alert when shopping cart is empty or I want this alert only when the page is left with entries in shopping cart 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 Quesion: Show each movie in the database on its own page, and give the user links in a "page 1, Page 2, Page 3" - type navigation system. Hint: Use LIMIT to control which movie is on which page. I have provided 3 files: 1st: configure DB, 2nd: insert data, 3rd: my code for the question. I would appreciate the help. I am a noob by the way. First set up everything for DB: <?php //connect to MySQL $db = mysql_connect('localhost', 'root', '000') or die ('Unable to connect. Check your connection parameters.'); //create the main database if it doesn't already exist $query = 'CREATE DATABASE IF NOT EXISTS moviesite'; mysql_query($query, $db) or die(mysql_error($db)); //make sure our recently created database is the active one mysql_select_db('moviesite', $db) or die(mysql_error($db)); //create the movie table $query = 'CREATE TABLE movie ( movie_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, movie_name VARCHAR(255) NOT NULL, movie_type TINYINT NOT NULL DEFAULT 0, movie_year SMALLINT UNSIGNED NOT NULL DEFAULT 0, movie_leadactor INTEGER UNSIGNED NOT NULL DEFAULT 0, movie_director INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (movie_id), KEY movie_type (movie_type, movie_year) ) ENGINE=MyISAM'; mysql_query($query, $db) or die (mysql_error($db)); //create the movietype table $query = 'CREATE TABLE movietype ( movietype_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, movietype_label VARCHAR(100) NOT NULL, PRIMARY KEY (movietype_id) ) ENGINE=MyISAM'; mysql_query($query, $db) or die(mysql_error($db)); //create the people table $query = 'CREATE TABLE people ( people_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, people_fullname VARCHAR(255) NOT NULL, people_isactor TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, people_isdirector TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (people_id) ) ENGINE=MyISAM'; mysql_query($query, $db) or die(mysql_error($db)); echo 'Movie database successfully created!'; ?> ******************************************************************** *********************************************************************** second file to load info into DB: <?php // connect to MySQL $db = mysql_connect('localhost', 'root', '000') or die ('Unable to connect. Check your connection parameters.'); //make sure you're using the correct database mysql_select_db('moviesite', $db) or die(mysql_error($db)); // insert data into the movie table $query = 'INSERT INTO movie (movie_id, movie_name, movie_type, movie_year, movie_leadactor, movie_director) VALUES (1, "Bruce Almighty", 5, 2003, 1, 2), (2, "Office Space", 5, 1999, 5, 6), (3, "Grand Canyon", 2, 1991, 4, 3)'; mysql_query($query, $db) or die(mysql_error($db)); // insert data into the movietype table $query = 'INSERT INTO movietype (movietype_id, movietype_label) VALUES (1,"Sci Fi"), (2, "Drama"), (3, "Adventure"), (4, "War"), (5, "Comedy"), (6, "Horror"), (7, "Action"), (8, "Kids")'; mysql_query($query, $db) or die(mysql_error($db)); // insert data into the people table $query = 'INSERT INTO people (people_id, people_fullname, people_isactor, people_isdirector) VALUES (1, "Jim Carrey", 1, 0), (2, "Tom Shadyac", 0, 1), (3, "Lawrence Kasdan", 0, 1), (4, "Kevin Kline", 1, 0), (5, "Ron Livingston", 1, 0), (6, "Mike Judge", 0, 1)'; mysql_query($query, $db) or die(mysql_error($db)); echo 'Data inserted successfully!'; ?> ************************************************************** **************************************************************** MY CODE FOR THE QUESTION: <?php $db = mysql_connect('localhost', 'root', '000') or die ('Unable to connect. Check your connection parameters.'); mysql_select_db('moviesite', $db) or die(mysql_error($db)); //get our starting point for the query from the URL if (isset($_GET['offset'])) { $offset = $_GET['offset']; } else { $offset = 0; } //get the movie $query = 'SELECT movie_name, movie_year FROM movie ORDER BY movie_name LIMIT ' . $offset . ' , 1'; $result = mysql_query($query, $db) or die(mysql_error($db)); $row = mysql_fetch_assoc($result); ?> <html> <head> <title><?php echo $row['movie_name']; ?></title> </head> <body> <table border = "1"> <tr> <th>Movie Name</th> <th>Year</th> </tr><tr> <td><?php echo $row['movie_name']; ?></td> <td><?php echo $row['movie_year']; ?></td> </tr> </table> <p> <a href="page.php?offset=0">Page 1</a>, <a href="page.php?offset=1">Page 2</a>, <a href="page.php?offset=2">Page 3</a> </p> </body> </html> 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. 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.
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 Ishangarg61How 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 "....."; Hi guys I AM NEW TO PHP AND MYSQLI... TRYING TO CALL FUNCTION BUT I GOT ERROR CANT FIGURE OUT WITH IT IS, THANKS FOR HELP ME functions.php
<?php
echo mysqli_error($db);
<?php
<?php ERROR Parse error: syntax error, unexpected ';', expecting '{' in C:\wamp64\www\gloria-blog\index.php on line 9
THANKS
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?? { } } ?> 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 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? |