Apg Form PHP Project
Apg Form PHP Project
<head><title>
<?php
wont work :)
}
if(!$array['title']){
// if the title wasnt sent through the form, it will become whatever you set it equal to in the next line
$array['title'] = "apgForm";
}
echo $array['title'] .'</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>';
} else {
if(!(stristr($array['filename'],".xls"))){
$array['filename'] = $array['filename'] . ".xls";
}
}
// Change this to whatever you want the users to see after the form i s processed
$continue = ' Here is a the Comment form your info was just sent to <a href="test.xls">Click
Here</a> to see the excel file.<br> <a href = "index.php">Click Here</a> To Return to apgForm ';
// Change this to the character(s) you want to be placed instead of line breaks(new line, enter, etc)
$lbChar = " ";
//chr(9);
$cr = "\n";
//chr(13);
if($array){
// Make The Top row for the excel file and store it in the $header variable
$keys = array_keys($array);
foreach($keys as $key){
if(strtolower($key) != 'filename' && strtolower($key) != 'title'){
$header .= $key . $tab;
}
}
$header .= $cr;
//Make the line with the contents to write to the excel file.
foreach($keys as $key){
if(strtolower($key) != 'filename' && strtolower($key) != 'title'){
$array[$key] = str_replace("\n",$lbChar,$array[$key]);
$array[$key] = preg_replace('/([\r\n])/e',"ord('$1')==10?'':''",$array[$key]);
$array[$key] = str_replace("\\","",$array[$key]);
$array[$key] = str_replace($tab, " ", $array[$key]);
if (file_exists($array['filename'])) {
$final_data = $data;
//if the file does exist, then only write the information the
user sent
} else {
$final_data = $header . $data;
line in excel with titles) to the file
}
// open the file and write to it
if($fp){
</body>
</html>
apgForm 1.4
-----------------------------------------------------------------------------------------------------------Site: http://www.apg88.com/apgForm/
Email: [email protected]
-------------------------------------------------------------------------------------------------------------
Installation:
1. make any changes you need to apgform.php
2. upload it to your server and CHMOD the folder its in to 777
3. That's it!
apgForm is a PHP file capable of processing web forms and saving them directly into an Excel file.
apgForm receives any form with any number of textboxes, radio buttons, drop-down menus, hidden fields, and
password boxes and saves them to an Excel file.
apgForm can receive the form regardless of the way it was sent (POST, or GET.)
The file is named form.xls by default, but can be specified by sending a hidden field with the name of the file. For
example, putting this on the form would make the file test.xml
<input type="hidden" name="filename" value="test">.
apgForm is completely free!
The excel file doesnt mess up with line breaks (enter, new line, etc). It replaces the line brakes with a user defined
character or characters; it is a space by default.
Current Issue(s):
apgForm does not support the use of checkboxes. I am(still) tryi ng to fix that, and will update as soon as I can.