Question: The task is the server-side validation of an already structurally pre-created form (hence HTML level verification is not sufficient) according to the following conditions. a.
The task is the server-side validation of an already structurally pre-created form (hence HTML level verification is not sufficient) according to the following conditions.
a. The trackname field is required. The distance field is also required and can only be a number.
b. The from and to fields are required and they must contain a settlement name that is included in the array $places from the starting file. The two fields cannot match!
c. The time field is required and it must be in the format X:XX where the Xs are digits. The highest allowed value before the colon (:) is 7, and the value after it must be less than 60.
d. In case of incorrect input, an error message should appear next to the given field, informing about the cause of the error.
e. The form placed on the page should keep its state which means that the submitted values should be written back into the fields.
f. The div with ID success and its contents should only appear in the generated HTML code if the form was submitted by the user and no errors were found during validation.




Fill out the code below please.
$places = [
'rottk',
'Srvr',
'Smeg',
'Keszthely',
'Tapolca',
'Badacsonytrdemic',
'Nagyvzsony',
'Vrosld',
'Zirc',
'Bodajk',
'Szrliget',
'Dorog',
'Piliscsaba',
'Hvsvlgy',
'Rozlia tglagyr',
'Dobogk',
'Visegrd',
'Nagymaros',
'Ngrd',
'Becske',
'Mtraverebly',
'Mtrahza',
'Sirok',
'Szarvask',
'Putnok',
'Aggtelek',
'Bdvaszilas',
'Boldogkvralja',
'Storaljajhely',
'Hollhza'
];
?>
Task 2: Trip registration
Hyperlinks for testing
trackname=&from=&to=&distance=&time=
trackname=10.sz.+tra&from=&to=&distance=&time=
trackname=10.sz.+tra&from=Budapest&to=&distance=&time=
trackname=10.sz.+tra&from=Srvr&to=&distance=&time=
trackname=10.sz.+tra&from=Srvr&to=Srvr&distance=&time=
trackname=10.sz.+tra&from=Srvr&to=Dobogk&distance=&time=
trackname=10.sz.+tra&from=Srvr&to=Dobogk&distance=ezer&time=
trackname=10.sz.+tra&from=Srvr&to=Dobogk&distance=1000&time=
trackname=10.sz.+tra&from=Srvr&to=Dobogk&distance=1000&time=10
trackname=10.sz.+tra&from=Srvr&to=Dobogk&distance=1000&time=10%3A60
Correct input: trackname=10.sz.+tra&from=Srvr&to=Dobogk&distance=1000&time=4%3A10
TASK 2: TRIP REGISTRATION TASK 2: TRIP REGISTRATION TASK 2: TRIP REGISTRATION TASK 2: TRIP REGISTRATION
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
