Current location: Hot Scripts Forums » Programming Languages » PHP » can someone please help me make this script work with my form


can someone please help me make this script work with my form

Reply
  #1 (permalink)  
Old 03-15-10, 09:47 PM
YOURCONNEXX YOURCONNEXX is offline
New Member
 
Join Date: Mar 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
can someone please help me make this script work with my form

wirehopper told me to post this here



please go here and skip to step three


Tutorial: Fill in PDF Fields With Submitted Form Data
(its near the bottom and is titled 3. Add your data-processing PHP script to handle the posted data.)

i already have the form ready.

i did the <?php echo '<pre>'; print_r($_POST); echo '</pre>'; ?> thing and got the array below
(these are the form fields from my form. if you need the actual form i have it attached to the post. you can open it in adobe reader if u dont have acrobat)

Array
(
Address_Where_Player_Resides
CONSENT_AFFIDAVIT
City_Borough_or_Township_In_which_Player_Resides
County
Date_of_Birth
Date_of_Registration
Grade
Phone
Players_Name
Public_School_District_In_Which_Player_Resides
School_in_Which_Player_Will_Be_Enrolled_This_Fall
Zip_Code
age_on_may_31st
assosciation_name
height
weight
year_consent
)

even if you dont feel like writing out the code can u atleast explain what i need to change or add on to make this work with my form

i just need this script to work with my form. this php stuff is crazy. no one has a straight answer anywhere on the internet to give an understanding of php. anyone who reads thru the php part of this tutorial will clearly see that the way its explained doesnt really explain how anything works or what exactly should be added or changed to fit different forms
Attached Files
File Type: pdf 2010registrationformweb.pdf (286.8 KB, 73 views)

Last edited by YOURCONNEXX; 03-15-10 at 09:50 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-24-10, 10:14 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
What do you want the script to do, other than receive the data?

Here is a sample, this assumes two things.

1. You want data written to a text file.
2. You have a directory named "registrations" in the same directory as this file.

PHP Code:

<?php

$players_address         
=      (isset($_POST['Address_Where_Player_Resides']))                                 ? ucwords(strtolower(strip_tags($_POST['Address_Where_Player_Resides'])))                                 : NULL;
$consent                    =      (isset($_POST['CONSENT_AFFIDAVIT']))                                                 ? ucwords(strtolower(strip_tags($_POST['CONSENT_AFFIDAVIT'])))                                                 : NULL;
$city                         =     (isset($_POST['City_Borough_or_Township_In_which_Player_Resides']))   ? ucwords(strtolower(strip_tags($_POST['City_Borough_or_Township_In_which_Player_Resides']))) : NULL;
$county                     =      (isset($_POST['County']))                                                                         ? ucwords(strtolower(strip_tags($_POST['County'])))                                                                        : NULL;
$dob                         =      (isset($_POST['Date_of_Birth']))                                                             ? ucwords(strtolower(strip_tags($_POST['Date_of_Birth'])))                                                             : NULL;
$dor                            =     (isset($_POST['Date_of_Registration']))                                                     ? ucwords(strtolower(strip_tags($_POST['Date_of_Registration'])))                                                     : NULL;
$grade                        =      (isset($_POST['Grade']))                                                                         ? ucwords(strtolower(strip_tags($_POST['Grade'])))                                                                         : NULL;
$phone                     =   (isset($_POST['Phone']))                                                                         ? ucwords(strtolower(strip_tags($_POST['Phone'])))                                                                         : NULL;
$name                      =   (isset($_POST['Players_Name']))                                                             ? ucwords(strtolower(strip_tags($_POST['Players_Name'])))                                                             : NULL;
$district                     =   (isset($_POST['Public_School_District_In_Which_Player_Resides']))         ? ucwords(strtolower(strip_tags($_POST['Public_School_District_In_Which_Player_Resides'])))         : NULL;
$school                     =   (isset($_POST['School_in_Which_Player_Will_Be_Enrolled_This_Fall']))     ? ucwords(strtolower(strip_tags($_POST['School_in_Which_Player_Will_Be_Enrolled_This_Fall'])))     : NULL;
$zip                             =      (isset($_POST['Zip_Code']))                                                                     ? ucwords(strtolower(strip_tags($_POST['Zip_Code'])))                                                                     : NULL;
$age                            =   (isset($_POST['age_on_may_31st']))                                                         ? ucwords(strtolower(strip_tags($_POST['age_on_may_31st'])))                                                     : NULL;
$assoc                     =   (isset($_POST['assosciation_name']))                                                     ? ucwords(strtolower(strip_tags($_POST['assosciation_name'])))                                                     : NULL;
$height                     =   (isset($_POST['height']))                                                                         ? ucwords(strtolower(strip_tags($_POST['height'])))                                                                         : NULL;
$weight                     =   (isset($_POST['weight']))                                                                         ? ucwords(strtolower(strip_tags($_POST['weight'])))                                                                         : NULL;
$year_consent            =   (isset($_POST['year_consent']))                                                             ? ucwords(strtolower(strip_tags($_POST['year_consent'])))                                                             : NULL;

if(
$_POST) {
    if(
$players_address == NULL || $players_address == '') {
        
$error[] = 'Players Address was left blank, or was invalid.';
    }
    if(
$consent == NULL || $consent == '') {
        
$error[] = 'CONSENT_AFFIDAVIT was not properly filled out.';
    }
    if(
$city == NULL || $city == '') {
        
$error[] = 'City was left blank, or was invalid.';
    }
    if(
$county == NULL || $county == '') {
        
$error[] = 'County was left blank, or was invalid.';
    }
    if(
$dob == NULL || $dob == '') {
        
$error[] = 'Date of Birth was left blank, or was invalid.';
    }
    if(
$dor == NULL || $dor == '') {
        
$error[] = 'Date of Registration was left blank, or was invalid.';
    }
    if(
$grade == NULL || $grade == '') {
        
$error[] = 'Grade was left blank, or was invalid.';
    }
    if(
$phone == NULL || $phone == '') {
        
$error[] = 'Phone number was left blank, or was invalid.';
    }
    if(
$name == NULL || $name == '') {
        
$error[] = 'Players name was left blank, or was invalid.';
    }
    if(
$district == NULL || $district == '') {
        
$error[] = 'School District was left blank, or was invalid.';
    }
    if(
$school == NULL || $school == '') {
        
$error[] = 'School name was left blank, or was invalid.';
    }
    if(
$zip == NULL || $zip == '') {
        
$error[] = 'Zip Code was left blank, or was invalid.';
    }
    if(
$age == NULL || $age == '') {
        
$error[] = 'Age was left blank, or was invalid.';
    }
    if(
$assoc == NULL || $assoc == '') {
        
$error[] = 'Associations name was left blank, or was invalid.';
    }
    if(
$height == NULL || $height == '') {
        
$error[] = 'Height was left blank, or was invalid.';
    }
    if(
$weight == NULL || $weight == '') {
        
$error[] = 'Weight was left blank, or was invalid.';
    }
    if(
$year_consent == NULL || $year_consent == '') {
        
$error[] = 'Year of Consent was left blank, or was invalid.';
    }
        
    
//If there was an error, print it to the screen.
    
if(isset($error)) {
        echo 
'The submission was rejected because of the following errors: ';
        
$i 0;
            foreach(
$error as $value) {
                echo 
"\n<br/>" 'Error' . ++$i ' ' $value;
            }
    }
    else { 
//write data to a file, inside the "registration" directory;
        
$data "Name: $name \n 
Date of Birth: 
$dob \n 
Registered: 
$dor \n 
Age: 
$age \n 
Height: 
$height \n 
Weight: 
$weight \n 
Association: 
$assoc \n 
Phone: 
$phone \n
Address: 
$players_address \n 
City: 
$city \n 
County: 
$county \n
Zip Code: 
$zip \n \n
SCHOOL INFO \n \n
School: 
$school \n
District: 
$district \n
Grade: 
$grade \n
Consent: 
$consent \n
Year of Consent: 
$year_consent \n
"
;
                    
        
$file fopen('registrations/' $name '.txt''w');
        
fwrite($file,$data);
        
fclose($file);
        
//This needs to be a file on your server.
        
header('Location: http://mysite.com/thankyou.html');
    }
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Your Own Profitable and VERY unique eBusiness Voltaire General Advertisements 3 03-30-10 07:36 AM
Submit button....can it send info to my email w/out the use of php???? lisa33 HTML/XHTML/XML 7 10-17-06 12:46 PM
3 Column CSS Fluid Layout (IE 6 Problem) Heidenreich12 CSS 9 10-04-06 04:22 PM
use html to open application absvinyl HTML/XHTML/XML 5 09-18-06 03:04 PM


All times are GMT -5. The time now is 10:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.