php

[PHP/JavaScript]: How to refresh a Captcha?

I am showing Captcha in this way: <img src="ReturnCaptcha2.php" alt="CAPTCHA" width="100" height="50"> I have a hyperlink named "Reload" near it. I want to recall that PHP file without refreshing my page. Probably, AJAX is involved in it. Please assist. ...

Accessing array value

print_r($fanr); results in: HTML_QuickForm_text Object ( [_label] => FA-Nummer [_type] => text [_flagFrozen] => [_persistantFreeze] => 1 [_attributes] => Array ( [name] => auftragsnr [type] => text [value] => 123 ) [_tabOffset] => 0 [_tab] => [_lin...

Using a php function using a variable with delimiters

I would like to know If I can use a php function on a variable that contains delimiters like ' or ". I'm receiving a text content from my database and I would like to use: strip_tags($desc); on it but it does not work. Here is an example of what it can contain using var dump: string(1039) ""txt <a href=""/txt.php"" class=""txt"">txt</a...

What regex must I use?

Hi, I'm writing an application in PHP, and I need to replace any word between <!-- * and * --> with it's correspondenting element in $vars. For example, <!-- *foobar* --> In this case 'foobar' must be replaced by the variable $vars["foobar"]'s value. This is what I have now, but it does not work (it always returns <> :( ): preg_repl...

php exec command - relative paths not working

how to run external program from php with exec command using relative paths? <?php exec('program_name ......'); ?> this works only if program_name.exe is in the same directory as this php script. for example exec('something/program_name ......'); doesnt work if php script is not in the 'something' directory. anybody know...

how to disable a image button that acts as submit button

I have a image button thats acts as a form submit button: <a href="#" onClick="submitComment('+[id]+'); return false;"><img class="submitcommentimg" id="submitcommentimg<?php echo $id; ?>" src="/images/check.png" alt="Comment!" border="0"></a> What is the best way to 'disable' it to prevent accidental double clicking. ...

Php ming: How to load and access assets from a ming-created swf in Flash/Flex?

Hi! I'm using Ming to create an library swf, using the first code example below. How can I access the embedded png from my Flex application? Here's the php/ming code: <?php // Ming to create Library.swf //----------------------------------- // Create background... Ming_setScale(20.0000000); $movie = new SWFMovie(); ming_useswfversion(7)...

Is there an easy way to save a section from a rendered web page as an image?

I want to provide the ability to save some rendered data/charts (with the titles and other information not included in the image) by specifying the coordinates and size in the browser window that contains the data I want to save. Is there any way to do this? ...

PHP function inside function.

This code produces the result as 56. function x ($y) { function y ($z) { return ($z*2); } return($y+3); } $y = 4; $y = x($y)*y($y); echo $y; Any idea what is going inside? I am confused. ...

jquery ajax doesn't work in IE

Hello, i have the following function to add an article in my basket: $(".addtocart").click(function(){ var product = $("#pid").val(); var qty = $("#qty").val(); if(isNaN(qty) || qty == '') alert("ERROR"); else{ alert("HIHI"); $.ajax({ type:"post", ...

Search query is automatically executed on each load, without clicking the search button

I want my code to execute a query based on the values in the search keyword text boxes. But the current code executes the default query each time at the time of loading, Help. Any help will be appreciated. Plz help rentals_search.template.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DT...

How to make a nav bar in a single php page with mouseovers and current page images?

I've been making pages with navigation with three states: normal, hover, and current page. Normally I just use a simple mouseover script, and I include the navigation code on every page so that I can make the link for the current page inactive, and a different, third image. This is a sloppy way of doing it. What's the best way to do thi...

Documentation for large or small Projects with PHP ?

Hi, we are talking a lot about documentation for programmers in the moment. How do you handle this part? What is the best method to introduce a new team guy into an "large" PHP Project. What does a new guy need? My thoughts so far: good source code api documentation generated through phpdoc clear coding style / guideline Some kin...

Why is this statement true in PHP?

I don't understand why this statement in PHP echos 'whaaa?' -- (0x0F | 0xF0) should be 0xFF no? if((0x0FFFFFFF | 0xF0FFFFFF) != 0xFFFFFFFF) echo 'whaaa?'; ...

How to send a server error response using php?

Hi all, As soon as the user clicks the delete button my jQuery script asks the server to delete the selected item. Now I want my php script to send a success or an error response. Is it possible to fire the error callback in case the item could not be deleted? Thanks my jQuery code: $.ajax({ type: "post", url: "myAjax.php" , d...

how to split name and email address in php or using regular expression

I have following string: "Test, User" < [email protected] >, "Another, Test" < [email protected] >, ......... I want following result: array( array('name' => 'Test, User', 'email' => '[email protected]'), array('name' => 'Another, Test', 'email' => '[email protected]'), ........... ) ...

open file with raw csv data, explode array and subarray, change line, and pack it back up and save, in PHP

My goal here is to open temp.php, explode by ### (line terminator), then by %% (field terminator). Change a specific field, on a specific line, then implode everything back together and save it. There are a couple variables at play here: row = the target row number target = the target field/column number nfv = the info that i want to p...

PHP preg_replace error

I have the following code: protected function safePath($path) { $path = (string) $path; $path = preg_replace( array( '#[\n\r\t\0]*#im', '#/(\.){1,}/#i', '#(\.){2,}#i', '#(\.){2,}#i', '#\('.DIRECTORY_SEPARATOR.'){2,}#i' ), array( '', '', '', '/' ), ...

PHP, MySQL: Duplicate series of rows, but change 1 column?

I have a table called scheduler_sched which has several columns, including a column called schedule_id. I need a function where I can pass 2 ids (copy_from_id, copy_to_id) as parameters. And what I need to do is take every row where schedule_id = copy_from_id AND duplicate it but change the copy_from_id to the copy_to_id So basically ...

javascript and utf-8 / special characters help

Hi. SHORT VERSION OF QUESTION: So basically my question is: How can I set the javascript to use UTF-8 so that å ä ö are supported, so my javascript can add the correct values to the drop list options? LONGER EXPLANATION: Im using javascript to fill 'options' in a drop down list on my main page. The drop down lists are in a form which ca...