WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Function that allows a Javascript cookie to be set after HTML has been outputted to the page.
Categories : PHP, Java Script, Cookies, HTML and PHP Click here to Update Your Picture
Michael Stearne
Date : Nov 23rd 1999
Grade : 2 of 5 (graded 3 times)
Viewed : 10839
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Michael Stearne
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

function JSSetCookie($CName,$CValue,$CExpr=FALSE){
// $CName is the name of the cookie
// $CValue is the value to be stored in the cookie
// $CXpr is in years
// This function will allow cookies to be set even after
// HTML has been printed on the page. It is a supplement to the
// SetCookie function when you have to output text before a cookie is set.

if($CExpr!=FALSE){
$CookieString="astr= '$CName' + '=' + '$CValue' + ';expires=' + expr + ';path=/';";
$Cookie.="\n<script language=\"javascript\">\n";
$Cookie.='function makeYearExpDate(yr){
var expire = new Date();
expire.setTime(expire.getTime() + ((yr *365) *24 * 60 * 60 * 1000));
expire = expire.toGMTString()
return expire
}
expr =makeYearExpDate('.$CExpr.');';
$Cookie.="\n".$CookieString."\n";
$Cookie.="document.cookie=astr;\n</script>\n";
}else{
$Cookie.="\n<script language=\"javascript\">\n";
$Cookie.="document.cookie='$CName=$CValue;path=/';";
$Cookie.="\n</script>\n";
}
echo $Cookie;
}



PHP4 session helper HTML file.
Categories : PHP, Java Script, HTML and PHP, Sessions
Dynamic Calender in PHP, Javascript and HTML.
Categories : PHP, Java Script, HTML and PHP, Calendar
Complete, simple working example of login screen and check on a unique page using php functions, cookies and mysql database.
Categories : PHP, Cookies, MySQL, HTML and PHP, Authentication
Pull Down Surfing - Surf on Change
Categories : Java Script, MySQL, HTML and PHP, PHP, Databases
Remote Scripting: send form POST data to a script and insert the results into a page without refreshing the page.
Categories : PHP, AJAX, HTML and PHP, Java Script
Dynamic generation of textboxes, select items etc in a table for use with databases applications, matrimonials and for job sites
Categories : PHP, HTML and PHP, Java Script
Tree Menu Dynamic (+Static) with Loading in Progress..
Categories : PHP, Java Script, HTML and PHP
OverEasy - PHP generated JavaScript to do mouseovers on your pages. Modify one file and one function does it all for you!
Categories : PHP, Java Script, HTML and PHP, MySQL
This PHP function creates dropdown select lists for time and date that you can change, outputs a 14 char MySQL timestamp in a text field
Categories : PHP, MySQL, Java Script, HTML and PHP
Local-to-user date and time display regardless of time zone or where the website's server is located
Categories : PHP, Date Time, HTML and PHP, Java Script
PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
Smart Counter - This little script is a plain and simple hit counter that uses cookies to determine whether or not the visitor has already been counted.
Categories : Cookies, HTML and PHP, PHP
Store, retrieve and delete cookies using JavaScript.
Categories : Java Script, Cookies, Beginner Guides, Cookies
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
Make old style (PHP3) scripts using GET, POST, COOKIE and File uploads (POST) compatible with PHP 4.2.0
Categories : PHP, HTML and PHP, Global Variables, Cookies, Variables