Starting with the php error messages for line 38. The $rec variable doesn’t exist at that point in the code, so trying to echo $rec[0] won’t work. The query that is setting $rec is after that point in the code.
I don’t know if you have some code elsewhere that is initially setting $_GET[‘Client_id’] when the page is first requested, but $_GET[‘Client_id’] won’t be set after you submit the form, because the form is actually a get method form (the form data replaces any get parameter that would have been propagated in the url.) The reason for this, despite what looks like a method=‘post’ attribute, is because you apparently copied the method=”POST”
attribute from somewhere and it has smart/curly quotes, which are meaningless in programming languages. I recommend that you delete and retype that using straight quotes. This will let you use the proper $_POST data in your form processing code. Also, don’t copy variables to other variables without any reason. Just keep the submitted data as an array and use elements in the array throughout the rest of the code.
$_GET[‘Client_id’] is a ‘required’ input for the page to work. It’s an error if it isn’t an integer greater then zero. You must validate all inputs before using them and setup a user error message for any input that isn’t valid. If there’s not a valid Client_id value, there’s no point in running the SELECT query or outputting the form.
If the SELECT query matches no data, again, this is an application error and you should setup a user error message that the query didn’t match any data and not attempt to output the form.
Lastly, use prepared queries when supplying external, unknown, dynamic values to a query when it gets executed, use exceptions for database statement errors, and switch to the much simpler PDO extension.