Search Results

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

Page 225/1708 | < Previous Page | 221 222 223 224 225 226 227 228 229 230 231 232  | Next Page >

  • How to check if a checkbox/ radio button is checked in php

    - by user225269
    I have this html code: <tr> <td><label><input type="text" name="id" class="DEPENDS ON info BEING student" id="example">ID</label></td> </tr> <tr> <td> <label> <input type="checkbox" name="yr" class="DEPENDS ON info BEING student"> Year</label> </td> </tr> But I don't have any idea on how do I check this checkboxes if they are checked using php, and then output the corresponding data based on the values that are checked. Please help, I'm thinking of something like this. But of course it won't work, because I don't know how to equate checkboxes in php if they are checked: <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $id = mysql_real_escape_string($_POST['idnum']); if($_POST['id'] == checked & $_POST['yr'] ==checked ){ $result2 = mysql_query("SELECT * FROM student WHERE IDNO='$id'"); echo "<table border='1'> <tr> <th>IDNO</th> <th>YEAR</th> </tr>"; while($row = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td>" . $row['IDNO'] . "</td>"; echo "<td>" . $row['YEAR'] . "</td>"; echo "</tr>"; } echo "</table>"; } mysql_close($con); ?>

    Read the article

  • Passing a String from PHP to a JavaScript function

    - by user635614
    Hello. am trying to write a code to pass a php string when clicked on the table : <?php . . . echo("<td onclick = 'print_("$file[$i]->Name");' >". $files[$i]->Name."</td>"); ... ?> where files[] is an array, and each element is a class with Name as a String, and it is put in a ''for'' loop, Am trying to pass it to a JavaScript function where i need the name there,and it's not working,i tried passing the i variable and it was passed correctly so i thought there should be a special syntax for dealing with strings... function print_(var x) { alert(x);}

    Read the article

  • PHP troubleshooting unexpected T_PUBLIC error

    - by jasondavis
    PHP is driving me insane right now, please help me, I must be missing something. In this VERY BASIC example below I get this error... Parse error:syntax error, unexpected T_PUBLIC in C:\filename here on line 12 On this line.... public static function getInstance(){ The code... <?PHP class Session{ private static $instance; function __construct() { { session_start(); echo 'Session object created<BR><BR>'; } public static function getInstance(){ if (!self::$instance) { self::$instance = new Session(); } return self::$instance; } }

    Read the article

  • test php disabled caching

    - by user1691389
    My site had a problem in that certain browsers (especially opera and gecko) were "over-caching" (caching far too much for my taste). I've just added the following PHP snippet to hopefully disable caching in all browsers: <?php header("Expires: Tue, 01 Jan 2000 00:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> Question: How would you test this out, to make sure it actually works?

    Read the article

  • problem with logout script in php

    - by user225269
    I'm a beginner in php, and I am trying to create a login and logout. But I am having problems in logging out. My logout just calls for the login form which is this: <? session_start(); session_destroy(); ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="checklogin.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Member Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="myusername" type="text" id="myusername"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="mypassword" type="text" id="mypassword"></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="submit" name="Submit" value="Login"></td> </tr> </table> </td> </form> </tr> </table> My problem is, when I try to press the back button in the browser. Whoever user is using it can still access what is not supposed to be accessed when a user hasn't logged in. Do I need to add a code on the user page? I have this code on the user page: <? session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> What can you recommend that I would do so that a script will prompt to enter the username and password again when a user clicks on the back button.

    Read the article

  • javascript not loading after output of PHP file_get_contents() string

    - by mives
    I have the following structure: -uploadpage.html -index.php -resources -jquery.1.4.2.min.js On my index.php, I get the contents then output uploadpage.html through this code: $output = file_get_contents("uploadpage.html"); echo $output; My upload.html has the javascript at the bottom: <script type="text/javscript" src="./resources/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(document).ready( function() { callSomething(); } ); function callSomething() {return true;} </script> However this results in an error "$ is not defined" which means that the jquery js file is not loaded. Any ideas?

    Read the article

  • PHP and C# communication with Encrypt/Decrypt

    - by SilentWarrior
    Hello, I have been searching and cant find a consistent solution to my problem : I want to encrypt something in C# and decrypt it in PHP but also be able to encrypt in PHP and decrypt in C#, using the same key on both ends. All the solutions I found dont seem to work both ways, most of them only work on one language and then fail on the other, either by decrypting wrong or by blowing up the offsets. I would like to use TripleDES but it isnt a requirement, just want something relatively strong for plain text communication (will either use JSON or just plain key-value pairs for complex stuff). Thanks in advance PS: http://pastie.org/643106 this is what I have been testing with.

    Read the article

  • ASP.NET equivalent of this PHP code

    - by moiz217
    Please provide asp.net equivalent of this php code. $ip = $_REQUEST['ip']?$_REQUEST['ip']:$_SERVER["REMOTE_ADDR"]; $client = new SoapClient(null, array( 'location' => "http://www.itistimed.com/soap/whois-city.php", 'uri' => "http://www.itistimed.com/soap/req")); $data = $client->ipToCountryCity($ip); var_dump($data); Will display something like: array(7) { ["status"]= int(1) ["status_text"]= string(7) "Success" ["country"]= string(2) "US" ["city"]= string(13) "Mountain View" ["state"]= string(2) "CA" ["zip"]= string(5) "94043" ["org"]= string(11) "Google Inc."} thanks.

    Read the article

  • .net equivalent for php preg_replace

    - by Hath
    What is the c#.net equivalent for php's preg_replace function? php code is like this: const ALLOW_VALUES = '[^a-z0-9àáâäèéêëìíîïòóôöùûwýÿyÁÂÄÈÉÊËÌÎÏÒÓÔÖÙÛÜWYÝ]'; public function streetTownHash($data, $hashCheck = false, $updateRecord = false) { foreach($data as $key=>$value){ try{ $value = mb_convert_case($value, MB_CASE_LOWER, "UTF-8"); } catch(Exception $e) { echo "Requires extension=php_mbstring.dll enabled ! - $e"; } $valueConcat .= preg_replace('/'.self::ALLOW_VALUES.'/','',$value); # Remove punctuation etc } $streetTownHash = sha1($valueConcat); .... this is as far as i've got but not sure about it.. private SHA1 hash = SHA1.Create(); private string hashAllowed = "[^a-z0-9àáâäèéêëìíîïòóôöùûwýÿyÁÂÄÈÉÊËÌÎÏÒÓÔÖÙÛÜWYÝ]"; public string HashString(string value) { value = // = regex not sure this part var bytes = ASCIIEncoding.UTF8.GetBytes(value); var hashed = hash.ComputeHash(bytes); return ASCIIEncoding.UTF8.GetString(hashed); }

    Read the article

  • simple php script

    - by Nerdysyntax
    New to php and taking a class for it. Bought php6 and mysql 6 bible to get started. Of course the hello world script is the first you get and it doesn't show. It just reads part of my script and I'm not sure the problem. Link to test - http://harden6615.com/ I am using a hosted server I bought for class, but I have also check it using MAMP. I figured my script is wrong, but I have copied and pasted and still no Hello World. Any suggestions? What I copied: <?php print("Hello, World<BR />\n"); phpinfo(); ?>

    Read the article

  • Create unique links for indvidual elements of a PHP generated table

    - by typoknig
    I have a table generated from some PHP code that lists a SMALL amount of important information for employees. I want to make it so each row, or at least one element in each row can be clicked on so the user will be redirected to ALL of the information (pulled from MySQL database) related to the employee who was clicked on. I am not sure how would be the best way to go about this, but I am open to suggestions. I would like to stick to PHP and/or JavaScript. Below is the code for my table: <table> <tr> <td id="content_heading" width="25px">ID</td> <td id="content_heading" width="150px">Last Name</td> <td id="content_heading" width="150px">First Name</td> <td id="content_heading" width="75px">SSN</td> </tr> <?php $user = 'user'; $pass = 'pass'; $server = 'localhost'; $link = mysql_connect($server, $user, $pass); if (!$link){ die('Could not connect to database!' . mysql_error()); } mysql_select_db('mydb', $link); $query = "SELECT * FROM employees"; $result = mysql_query($query); mysql_close($link); $num = mysql_num_rows($result); for ($i = 0; $i < $num; $i++){ $row = mysql_fetch_array($result); $class = (($i % 2) == 0) ? "table_odd_row" : "table_even_row"; echo "<tr class=".$class.">"; echo "<td>".$row[id]."</td>"; echo "<td>".$row[l_name]."</td>"; echo "<td>".$row[f_name]."</td>"; echo "<td>".$row[ssn]."</td>"; echo "</tr>"; } ?> </table>

    Read the article

  • Help getting PHP sessions to persist after being taken off-site

    - by Rob
    Hi, we're working on a payment gateway system with PHP. We use sessions to store the shopping cart data. The system takes you off-site to the payment processor's site, and then return you to your site. On most hosts, we have no issues when we arrive back at our site and having the session data still be there. On those with an issue, turning off the PHP session referer_check has worked in the past. We don't really want to have to include the PHPSESSID as a GET variable, and hope to avoid that. What I'm looking for is what other server configurations would cause the session to be killed, and any other workarounds there might be. Thanks for your help.

    Read the article

  • how to get the value of checksum in php header

    - by sumit
    I have a header in php which contains a link like <?php header("Location: "."https://abc.com/ppp/purchase.do?version=3.0&". "merchant_id=<23255>&merchant_site_id<21312>&total_amount=<69.99>&". "currency=<USD>&item_name_1=<incidentsupporttier1>&item_amount_1=<1>&". "time_stamp=<2010-06-14.14:34:33>&**checksum=<calculated_checksum>**"); ?> when i run this page the value of checksum is calculated and the link is opened now how checksum is calculated? calculated_checksum=md5(abc); md5 is an algorithm which calculates the value of checksum based on certain values inside the bracket. now i want to know how can i pass the value of checksum in the header url

    Read the article

  • Executing ffmpeg from php running in apache

    - by foobar
    I was executing ffmpeg from php running inside apache. I used to get the error " error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory". It used to work perfectly if the php script was executed from the command prompt or ffpmeg was directly invoked from the command prompt. I followed the below steps to fix the apache error: Step 1: Check if the file “libavdevice.so.52? exists in the server using the following command. find / -name ‘libavdevice.so.*’ Step 2: You will get the directory in which the file “libavdevice.so.52? exists from the above command. Suppose the directory is “/usr/local/lib/” in this example. Step 3: You have to add the directory name in the file “/etc/ld.so.conf”. Step 4: Execute the command “ldconfig”. How did doing the above make a difference to apache?

    Read the article

  • PHP Zip Archive sporadically creating multiple files

    - by user516558
    I have a PHP script (running PHP 5.2 on Apache 2.2) that creates a zip archive of files for a user to download. Everything seems to work just fine; the only issue I have is that periodically multiple files will be created before the ZIP archive is successfully finished. Example: archive-name.zip archive-name.zip.a09600 archive-name.zip.b09600 archive-name.zip.c09600 This does not happen every single time; only periodically - the file is still created but sometimes these extra 'files' are left on the server after it finishes. The code that creates the ZIP archive is as follows: $zip_archive = new ZipArchive(); $zip_archive->open($archiveFullName,ZIPARCHIVE::CREATE); if(!file_exists($archiveFullName)) { foreach ($completed_file_arr as $zip_file) { $isFiller = substr($zip_file,-8) == "_err.txt"; if(!$isFiller) { $zip_archive->addFile($zip_file,$localname); } else $zip_archive->addFromString ($zip_file, "The requested source file could not be found."); } } while(!$zip_archive->close()) sleep(1); //ensure that the ZIP file finishes closing

    Read the article

  • Help with php custom popup

    - by user329394
    Hi i have create a custom popup using javascript to use in PHP file. thw popup will appear when user click My Special Website i need to change the title header. Can help me how to do it?? //function: function myPopup() { window.open( "<?=$CFG->wwwroot.'/example.php';?>" ,"myWindow", " height = 300, width = 600, statusbar=0, scrollbars=0,resizable=0, location=0,status=0, directories=0, menubar =0, toolbar =0 , left = 262,top = 234" ) } // call: <a href="#" onclick="myPopup() " >My Special WebSite </a> <span class="style1">*</span> See my sample page:

    Read the article

  • How to know record has been updated successfully in php

    - by Lisa Ray
    $sql = "UPDATE...."; if(mysql_query($sql)) { $_SESSION['Trans']="COMMIT"; header("location:result.php"); exit; } else { $_SESSION['Trans']="FAIL"; $_SESSION['errors'] = "Error: Sorry! We are unable to update your Profile, Please contact to PNP HelpDesk."; header("location:result.php"); exit; }//end IF data is getting updated then why compiler is not coming inside IF condition.

    Read the article

  • PHP HTML variable

    - by Abakiz Myth
    In Coldfusion we have the variable: <cfsavecontent name="HTML_content"> <div class="test_div" style="color:#FFF;">Test</div> </cfsavecontent> Within PHP there seems to be no way of doing this without some really hacky function or escaping double quotes. I'm trying to create emails (large html documents) within the same page by saving the email content and simply mailing it but it seems like there's no way of doing this within PHP without using $var = "\"crap\""; Can somebody point me in the right direction?

    Read the article

  • PHP OOP problem

    - by Isis
    Hello <?php class Templater { var $params = array(); public static function assign($name, $value) { $this->params[] = array($name => $value); } public static dunction draw() { return $this->params; } } <?php $test = Templater::assign('key', 'value')->draw(); print_r($test); I need to function "assign" was static, but $params was common for the whole class.. BUt this code is not working(( Fatal error: Using $this when not in object context Any ideas?

    Read the article

  • Create a PHP cache system in MySQL database?

    - by Zach Smith
    I'm creating a web service that often scrapes data from remote web pages. After scraping this data, I have a simple multidimensional array of information to use. The scraping process is fairly taxing on my server, and the page load takes a while. I was considering adding a simple cache system using a MySQL database, where I create one row per remote web page with a the array of information pulled from it stored as a JSON encoded string. Is this a good enough system? Or would something like a text file per web page be a better idea?

    Read the article

  • removing index.php of codeigniter on local

    - by Aldi Aryanto
    i'm trying to remove index.php,in my localhost, but it seems doesn't working,its on http://localhost/testing i put .htacces in 'testing' directory under the htdocs LoadModule rewrite_module modules/mod_rewrite.so at apache/conf also already uncheck here my .htaccess RewriteEngine On RewriteBase /testing/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /testing/index.php/$1 [L] here my config $config['base_url'] = "http://localhost/testing"; $config['index_page'] = ''; $config['uri_protocol'] = 'AUTO'; when i access login controller, it's not found Not Found The requested URL /testing/login was not found on this server. I really don't know what to try next. Any help would be appreciated.

    Read the article

< Previous Page | 221 222 223 224 225 226 227 228 229 230 231 232  | Next Page >