Do feel free to ask any questions that you may have concerns to web. No Compromise on Learning!
Tuesday, February 22, 2011
Monday, February 14, 2011
Get Full URL
The PHP super global $_SERVER contains all the information you need to access various information about the URL and can even carry variables. Often you need to get the full URL of the page you are on and this requires piecing together several of the $_SERVER variables to get the whole URL.
Here we have done the work for you so you do not need to go searching through $_SERVER to find the correct super global variables to work with.
/****
How to get Full URL
***/
function getFullURL()
{
/* Here we check for https*/
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
/* return the full address */
return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
/* TO GET URL CALL FUNCTION LIKE THAT*/
echo getFullURL();
?>
Here we have done the work for you so you do not need to go searching through $_SERVER to find the correct super global variables to work with.
/****
How to get Full URL
***/
function getFullURL()
{
/* Here we check for https*/
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
/* return the full address */
return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
/* TO GET URL CALL FUNCTION LIKE THAT*/
echo getFullURL();
?>
Thursday, February 10, 2011
How to Submit a Form Using JavaScript
Generally, a form is submitted when the user presses a submit button. However, sometimes, you may need to submit the form programmatically using JavaScript.
JavaScript provides the form object that contains the submit() method. Use the ‘id’ of the form to get the form object.
For example, if the name of your form is ‘myform’, the JavaScript code for the submit call is:
document.forms["myform"].submit(); |
But, how to identify a form? Give an id attribute in the form tag
<form id='myform' action='formmail.pl'> |
Here is the code to submit a form when a hyperlink is clicked:
<form name="myform" action="handle-data.php"> |
Search: <input type='text' name='query' /> |
<a href="javascript: submitform()">Search |
|
<script type="text/javascript"> |
function submitform() |
{ |
document.myform.submit(); |
} |
|
http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
Subscribe to:
Posts (Atom)
How to change the PHP version for subfolders or subdomains
How to change the PHP version for subfolders or subdomains Setting a specific PHP version for a specific websites, subfolders or subdomain...
-
What is PHPSpreadSheet Library PHPSpreadSheet library is purely writter in PHP and it main purpose of communicate your PHP application with ...
-
I would make a function that checks every selected value, and then enables all option s, searches through the .staff_list s for option s ...
-
DATE_SUB() Getting the recent one month or year records from MySQL table Syntax of DATE_SUB() DATE_SUB(date, INTERVAL, expression, UNIT) E...
