Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 170/1708 | < Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >

  • JQuery and PHP validation problem?

    - by DuH
    I want to do the validation on my PHP side and then have my JQuery code display your changes have been saved when the submit button is clicked but the JQuery code states that the changes have been saved even when the validation fails. How can i fix this so that PHP can do the validation and then JQuery can do its thing when PHP has finished its validation? Here is my Jquery code. $(function() { $('#changes-saved').hide(); $('.save-button').click(function() { $.post($('#contact-form').attr('action'), $('#contact-form').serialize(), function(html) { $('div.contact-info-form').html(html); $('#changes-saved').hide(); $('#changes-saved').html('Your changes have been saved!').fadeIn(4000).show(); }); $('a').click(function () { $('#changes-saved').empty(); $('#changes-saved').hide(); }); return false; // prevent normal submit }); });

    Read the article

  • Stop PHP from creating arrays in $_POST superglobal

    - by cdmckay
    PHP will automatically convert <input type="text" name="foo[0]" value="x" /> <input type="text" name="foo[1]" value="y" /> into $_POST['foo'] = array( 0 => 'x', 1 => 'y' ); Which is what you want most of the time. However, in this case I would like this not to happen. Is there anyway to tell PHP to not do this? I realize I could parse php://input myself, but I'd rather not do that if I can avoid it. I also don't have the option of renaming the input names.

    Read the article

  • PHP: Star rating system concept?

    - by Prashant
    I am using PHP/MYSQL/JQUERY. I have a site which have news section. On news details page, I want to add star rating system which will allow user to rate the news story. I am using this jquery rating system http://www.fyneworks.com/jquery/star-rating/ Now, I am not getting what will be the database structure and then what I need to code in PHP. I need what logic will be applied for this, like if 1000 people voted for the article, some given rating as 2 or 3 or1 or 5. Then Where I should be storing (db structure) this all and what I'll calculate (in php code). If someone has any article which shows this concept please provide. Please help, to understand the logic and concept of this. Thanks!

    Read the article

  • Live output from .jar executed by PHP

    - by user2926097
    I have a php-script which executes a .jar-file: <?php passthru("java -jar nlp-server.jar 9000"); ?> I want to display the output generated by this .jar-file on a website. The problematic part is the fact that the .jar-file doesnt finish executing because its a server-application. Thus navigating to the php-file wont help and I didnt manage to make AJAX work either. Is there a way to display the "live" output of the .jar-file on a website?

    Read the article

  • Execute PHP after new Order in Magento

    - by Israel Lopez
    Hello There, I'm trying to figure out where I could drop in some PHP code to notify a CRM we are using (Solve360) that a new order has been placed, and that an event should be created (API) to fulfill the order. Order Product Checkout Complete Checkout & Capture CC Side notify CRM Done Not sure where to start, but I have had to make some small tweaks to fix the Quantum Gateway payment processor to work. In that module it appears that the objects for the order (email, amt, details) were available. However it seems it would be quite 'dirty' to insert more PHP code in there. Ideas? PHP 5.2.x & Magento 1.4.x

    Read the article

  • PHP/JS/JQUERY: Smart method to Auto check/updating a points status

    - by Azzyh
    Hello. Hi everyone. So right now I am using me of this: function checkpoints() { var postThis = 'checker.php?userid='+ $('#user_id_points').val(); $.post(postThis, function(data){ $(".vispoints").html(data).find(".vispoints1").fadeIn("slow") }); setTimeout(checkpoints, 5000); } This function repeats each 5 seconds (sending request each 5 seconds) and running the checker.php each 5 seconds, to show how many points you got. (checker.php echo out how many points you've got in a span class vispoints1). Now isnt there a smarter method doing this, instead of sending requests like this all the time.. I mean sites like facebook and that, they dont do like this to check if you e.g got a new friend request? Hope you can help me find a better method examples would be good too.

    Read the article

  • Bit conversion operations in PHP

    - by Goro
    Hello, I find myself in need of performing bit-level conversion on variables in PHP. In more detail, I have a bit stream that is read as an integer by hardware, and I need to do some operations on the bits to make it into what its actually supposed to be (a float). I have to do this a few times for different formats, and the functionality I need is Being able to select and move individual bits in a variable Being able to cast statically one type of variable to the other (ie. int to float) I know php natively supports bitwise AND, OR, etc, and shift operations, but I was wondering if: there may already be a library in php that does this sort of thing I would be better off with delegating the calculations to some other language Thanks,

    Read the article

  • PHP MySQL New Lines / Whitespaces from textarea

    - by rob_robsen
    I've a problem about whitespaces and new lines at the beginning of a textarea. I send a json string with ajax to the php script. Then I decode the string into an php array (with json_decode). So I have a string in this array with two line breaks at the beginning. If a print the text from the array, the line breaks are there, but if I store the text into the mysql database, the line breaks are gone... Only at the beginning of the string, the line breaks gone... At the rest of the string, the line breaks are ok. Thanks for your answers! rob

    Read the article

  • How to work with PHP abstract?

    - by YumYumYum
    Why would you use such abstract? Does it speed up work or what exactly its for? // file1.php abstract class Search_Adapter_Abstract { private $ch = null; abstract private function __construct() { } abstract public funciton __destruct() { curl_close($this->ch); } abstract public function search($searchString,$offset,$count); } // file2.php include("file1.php"); class abc extends Search_Adapter_Abstract { // Will the curl_close now automatically be closed? } What is the reason of extending abstract here? Makes me confused. What can i get from it now?

    Read the article

  • static images aren't caching with php-generated page

    - by scootklein
    Our website was just converted to being generated by mod_rewrite and php scripts. Images aren't caching in browsers when they seemingly should be. All images follow format: <img src="/images/header.png" /> I must avoid the script completely caching because the PHP parser needs to handle each page dynamically on each request; however, the download overhead of the large images is cumbersome on every single page load. I would ideally provide headers for "Cache-Control: no-cache, must-revalidate" and "Expires: some_date_in_the_past" to force revalidation of the PHP script. Why isn't the browser caching static images with consistent href values across all pages?

    Read the article

  • json service from data scraping with php

    - by fredz0003
    I am trying to figure out what is the best way to make this work, I am new to php. I was able to make my script work to find specific data on my htm file with the following script tested on my local server. <?php include ('simple_html_dom.php'); //create DOM from URL or local file $html = file_get_html ('Lotto Texas.htm'); //find td class name currLotWinnum and store in variable winNumbers foreach($html ->find('td.currLotWinnum') as $winNumbers) //print winNumbers echo "<b>The winning numbers are</b><br>"; echo $winNumbers -> innertext . '<br>'; ?> Need some light here, ultimately I would like to create a web service to return json format and access that data from my iOS application using NSJSONSerialization class.

    Read the article

  • In C, is it possible do free only an array first or last position?

    - by user354959
    Hi there! I've an array, but I don't need its first (or last) position. So I point a new variable to the rest of the array, but I should free the array first/last position. For instance: p = read_csv_file(); q = p + 1; // I don't need the first CSV file field // Here I'd like to free only the first position of p return q; Otherwise I've to memcpy the array to other variable, excluding the first position, and then free the original array. Like this: p = read_csv_file(); q = (int*) malloc(sizeof(int) * (SOME_SIZE - 1)); memcpy(q, p+1, sizeof(int) * (SOME_SIZE - 1)); free(p); return q; But then I'll have the overhead of copying all the array. Is this possible to only free a single position of an array?

    Read the article

  • PHP: Mapped Network Drives

    - by Abs
    Hello all, I have mapped a network drive to a computer in my home network. Now I am trying to access it via PHP - I did this quick test: echo opendir('Z:\\'); This gives me: Warning: opendir(Z:\) [function.opendir]: failed to open dir: No error in C:\wamp\www\webs\tester-function.php on line 3 What have I done wrong here? I don't want my users typing in the UNC path so is there a way to get the UNC path for them and maybe that will work when I try to access it? This is possible in Microsoft languages but I am not sure how to get PHP to do this - maybe using a cmd.exe command? Please note, the mapped drive does exist as I can see it and I can access it. It also does not appear to be a permissions problem as I am assuming it would of complained about this IF it could access that drive...right? Thanks all for any help

    Read the article

  • Potential issue when using memcache session save handler in PHP

    - by Sean
    I have two load balanced web servers, and I'm using the memcache session save handler with the save path pointing to two memcache servers. It's configured with session redundancy set to two (the number of memcache servers). So PHP is writing session data to both memcache servers, and when I take one of the servers down, everything seems to work fine since the session data has been written to both memcache servers. The problem seems to happen when I use the app for a while with only the one memcache server up, and then bring the other one back up. My theory is that the memcache server comes back up, and PHP then starts asking it for session data which isn't there since it was written to the other server while this one was down. Is there any merit to this theory? Should PHP be asking both servers for the session data and maybe there's some other problem?

    Read the article

  • Google Contacts Data API and PHP

    - by pako
    I'm developing a PHP application to retrieve the list of contacts from a GMail account. I'm looking for a solution which would enable the user of my application to provide the login and password to their Gmail account in my application (as opposed to getting redirected to Google) and then automatically do the retrieval. The retrieval process can be run in PHP or JavaScript (which would then feed the list of contacts back to PHP using Ajax). Is it possible to do that? Which JavaScript API should I use for that? Can someone point me at the right chapter in Google Contacts Data API documentation?

    Read the article

  • PHP: How to overwrite values in one array with values from another without adding new keys to the ar

    - by Svish
    I have an array with default settings, and one array with user-specified settings. I want to merge these two arrays so that the default settings gets overwritten with the user-specified ones. I have tried to use array_merge, which does the overwriting like I want, but it also adds new settings if the user has specified settings that doesn't exist in the default ones. Is there a better function I can use for this than array_merge? Or is there a function I can use to filter the user-specified array so that it only contains keys that also exist in the default settings array? (PHP version 5.3.0) Example of what I want $default = array('a' => 1, 'b' => 2); $user = array('b' => 3, 'c' => 4); // Somehow merge $user into $default so we end up with this: Array ( [a] => 1 [b] => 3 )

    Read the article

  • Best practice for error handling in codeigniter / php apps

    - by Industrial
    Hi everyone, We're working with a new codeigniter based application that are cross referencing different PHP functions forwards and backwards from various libraries, models and such. We're running PHP5 on the server and we try to find a good way for managing errors and status reports that arises from the usage of our functions. While using return in functions, the execution is ended, so nothing more can be sent back. Right? What's the best practice to send a status information or error code upon ending execution of actual function? Should we look into using exceptions or any other approach? http://us.php.net/manual/en/language.exceptions.php

    Read the article

  • php cron jobs overlapping

    - by naveen gupta
    Hi I wrote few months back a script in perl for checking overlapping of jobs use Fcntl ':flock'; INIT { my $waitcount=12; # possible attemtps to run script my $waitseconds=300; # wait for $waitseconds each attempt my $lockstatus=0;#no lock was attained while ($waitcount > 0){ if (open LH, $0){ while ($waitcount > 0){ if (flock LH, LOCK_EX|LOCK_NB){ $waitcount=0;#signal end of waiting $lockstatus=1;#lock was attained } else{ --$waitcount;#decrement waitcount print "waiting to be able to lock $0\n"; sleep $waitseconds; }#end else }#end while }#end if else{ --$waitcount;#decrement waitcount print "waiting to be able to open $0\n"; sleep $waitseconds; }#end else }#end while if ($lockstatus == 0){ die "no lock was attained\n"; }#end if } I wanted to know if we can do similar thing in php .. How to integrate with your current php code which is running a part of php jobs?

    Read the article

  • get all fields value from mysql using php

    - by zahir hussain
    hi i want to know how to get all fields value search by array. i have array that s my table is id content 1 zahr 2 hai . . . and so on $a = {2,3,4,5,43,32}; i have to take the contents by this id(from array "a"). i know, i can use "for" loop for getting each element from mysql. but i would like to use any filters or any predefined function thanks and advance

    Read the article

  • JSON from jQuery to PHP

    - by enfix
    I need to pass a JSON object from $.post() jQuery function to PHP page. I tried this plugin jquery-json, but don't work: //include jquery.js and jquery.json.js $(document).ready(function(){ var data = new Object(); data.hello = "Hello"; data.world = "World"; var datajson = $.toJSON(data); $.post('file.php', {data: datajson}, function(res){ alert(res); }); }); And file.php has this simple line: <? var_dump(son_decode($_REQUEST['data'], true)); ?> What's the problem ?

    Read the article

  • PHP Store User Data without Sessions

    - by Sev
    Is there anyway to store users data such as userid, email, etc to be accessible from all pages of a website after they have logged in, but without using sessions or cookies? For example: class User { var $userid; var $username; var $email; .. methods.. } after they login at login.php $currentUser = new User($_POST['username']) now, how do I access $currentUser from another page, such as index.php if I shouldn't use sessions or cookies at all? so that I could do the following in index.php: if ($currentUser->userid > -1) { echo "you are logged in as: " . $currentUser->username; } else { echo "click here to login"; } i asked a similar question before, here, but the answers didn't fulfill my needs.

    Read the article

  • Hide header if node body is empty - Drupal php snippet help

    - by Toxid
    Hello! I've made a content type for links, I'm trying to make a link directory. People only have to submit the link, description is voluntary. If no description is entered, I want the header that says "description" to disappear. The description field is the node body. Right now my snippet looks like this <?php if (!empty($node->body)) {?> <div class="field field-type-link field-field-link-archive"> <h3>Description</h3> <?php print $node->content['body']['#value'] ?></div> <?php }?> I expect this to check if node body is not empty, and if it isn't it'll print what's there. The problem is that the Description header is still printed out even if the node body is empty. Can anyone see what's wrong?

    Read the article

  • Accessing a variable passed by jquery using php

    - by celenius
    How does php access a variable passed by JQuery? I have the following code: $.post("getLatLong.php", { latitude: 500000}, function(data){ alert("Data Loaded: " + data); }); but I don't understand how to access this value using php. I've tried $userLat=$_GET["latitude"]; and $userLat=$_GET[latitude]; and then I try to print out the value (to check that it worked) using: echo $userLat; but it does not return anything. I can't figure out how to access what is being passed to it.

    Read the article

  • php session_start() warning

    - by Eniasharmila Karunakaran
    I'm new to php.. Im trying to get value from session. Below is my code. Set session in login page session_start(); $_SESSION["username"] = $username ; $_SESSION["password"] = $password ; $_SESSION["companycode"] = $companycode; Get the session if(! isset($_SESSION)) session_start(); $a=$_SESSION["companycode"]; echo $a; But i got the warning in my page: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\lucent\clientlogin.php:216) in C:\xampp\htdocs\lucent\clientlogin.php on line 219 Please help. Thanks

    Read the article

  • Stopping and Starting Apache Using PHP (!)

    - by Abs
    Hello all, I have two problems which are related. 1) I have a batch file that contains this: net stop wampapache net start wampapache Which tries to stop and start my wamp server. When I double click the stop.bat file with the above it works successfully. When I try to run that from my PHP script, it stops the server but doesn't start it fully which I am guessing is because Apache is waiting for that PHP process to exit? function php_kill(){ exec('stop.bat', $output = array(), $return); return $return; } 2) Is there a way to restart my webserver (apache) whilst keeping session variables that PHP needs available? Thanks all

    Read the article

< Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >