Currently Browsing: Code

PHP sef url function

This is another PHP sef function, much better to use in case you want to get remove characters that are not a-z, 0-9, dash, underscore or space, then remove all leading and trailing spaces, change all dashes, underscores and spaces to dashes and return the modified string in lower case.
(more…)

Save PHP form in file

With php you can store data, save php form in text file such as notepad and even in microsoft word too.
The following php code will make you able to store form data in microsoft word file. It will create ms word file too that if file is not created before.

  1. < ?php
  2. $username = $_POST['username'];
  3. $fp = fopen("myfile.doc","a+") or exit("unable to open the file");
  4. if($fp != null)
  5. {
  6. fwrite($fp,$username);
  7. }
  8. fclose($fp);
  9.  
  10. ?>

(more…)