A Call to PHP Function on INPUT field is not working

In case you have problems with some other PHPJunkyard script (not that there are THAT many).
Post Reply
Easytime
Posts: 1
Joined: Thu Dec 13, 2012 2:20 pm

A Call to PHP Function on INPUT field is not working

Post by Easytime »

Script URL: localhost
Version of script: 5+
Hosting company: localhost
URL of phpinfo.php: localhost/
URL of session_test.php: localhost/
What terms did you try when SEARCHING for a solution:

Write your message below:
I've written a php function script to check the a default value of a text field during an onFocus and onMouseOut events.
The default value of the text field is 'Search'.
When a user sets focus on the text field, the value should clear to empty string.
When the user removes focus and without entering a text, the value should be set back to 'Search'.
Else a $value variable should be assigned the value of the user input in the text field.
Please see the code below and help me out - cos, I am having problem calling the script on the input field. I'm not even sure whether the script is wrong or not...

Code: Select all

<?php
function setValue()
	{
if (!empty($_REQUEST['qfront']) && $_REQUEST['qfront']=='Search')
	{
 
 $value=''; //$_REQUEST['qfront']="";
	}
	elseif (!empty($_REQUEST['qfront']) && $_REQUEST['qfront']!='Search')
	{
 $value=$_REQUEST['qfront'];
 	}
	else //if (empty($_REQUEST['qfront'])
	{
$value='Search';
	}
return setValue();
}
?>

Thank you!.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: A Call to PHP Function on INPUT field is not working

Post by Klemen »

Sorry, this is not a general PHP forum, but a forum where you can get help for scripts from www.phpjunkyard.com only!
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply