Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="text" name="names" placeholder="Enter Name" />
- <select name="gender">
- <option value="Male">Male</option>
- <option value="Female">Female</option>
- </select>
- <input type="text" name="age" placeholder="Enter Age" />
- <input type="text" name="state" placeholder="Enter State" />
- <label>How Did You Find Us?</label>
- <input type="checkbox" name="remarks[]" value="Search Engine (eg. Google)"> Search Engine (eg. Google)
- <input type="checkbox" name="remarks[]" value="Facebook"> Facebook
- <input type="checkbox" name="remarks[]" value="Newspaper Ads"> Newspaper Ads
- <input type="checkbox" name="remarks[]" value="Bus-Stop Ads"> Bus-Stop Ads
- $names = filter_input(INPUT_POST, "names");
- $gender = filter_input(INPUT_POST, "gender");
- $age = filter_input(INPUT_POST, "age");
- $state = filter_input(INPUT_POST, "state");
- $remarks = $_POST['remarks'];
- $inputArr[] = array(
- $names, $gender, $age, $state, $remarks
- );
- $fp = fopen($_SERVER["DOCUMENT_ROOT"]."/student.csv", "a+");
- fputcsv($fp, $inputArr);
- fclose($fp);
- Array
- (
- [0] => Melinda
- [1] => Female
- [2] => 23
- [3] => united state
- [4] => Array
- (
- [0] => Facebook
- [1] => Newspaper Ads
- [2] => Bus-Stop Ads
- )
- )
- Array
- (
- [0] => Melinda
- [1] => Female
- [2] => 23
- [3] => united state
- [4] => Array
- [5] => Facebook
- [6] => Newspaper Ads
- [7] => Bus-Stop Ads
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement