Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am working on an assignment where we are supposed to write php to 1) put each

ID: 3710476 • Letter: I

Question

I am working on an assignment where we are supposed to write php to
1) put each form submission to a new file in a specified data folder, with the title of the file being the lastnamefirstname.txt
2) stop processing the form and return an error message if first or last name are left blank
3) after the form is submitted, additionally show the user an output of their submission with the same general css styling as the form itself

I'm very lost, but I've tried writing the some of the code but none of it seems to work. Any suggestions on what is wrong with it and/or what needs to be added would be greatly appreciated.

svarState $_POST [' state']; varGenderPOST ['gender' svarCourses = $_POST [ ' course ' ] ; varBio_POST'bie' $error "". if (empty (SvarFirst)) [ ferror "Fdbaknans and Jaatname are required."; if (empty (varLast)) [ ferror "Fdbaknans and Jaatname are required."; if (Serror echo(iratnane and tastae are required.") else [ sfilename-_POSTt._POST'a newfile-fopen ("Data/$filename.xt", " or die("Unable to open") $txt-"testing" fwrite (Snewfile, /* i have no idea what to put here, should be the same info as following echo statements /) fclose (Snewfile): echo "Date:' Date (d.m.y): echo "First Name: _POST['firstname'" echo "Last Name: {$_POST ['lastname']}" ; echo "State: _POST['state'1" echo "Gender: {$_POST ['gender'])". echo "Courses Taken: _POST['course']" echo "BAR: {$_POST ['bio']}";

Explanation / Answer

You have done almost everything alright:

use:

$txt = 'Date:'.date('d.m.y')." First Name: $varFirst Last Name: $varLast State: $varState Gender: $varGender Courses Taken: $varCourses Bio: $varBio ";

fwrite($newfile,$txt);

and keep the echo statements in the else block.

also the d.m.y needs to be in quotes:

ex: date('d.m.y') or date("d.m.y")

but not like date(d.m.y)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote