An error occurred while uploading the image. no error was reported when I used this code.
War-game -Add Your scoreWar game - add your score
0){echo 'Error:'.$_FILES['image_upload']['error'].'
';}else{$dbc=mysqli_connect('localhost','root','pengyu2408','score_list')or die('error in connet');$query="INSERT INTO score_lis(first_name,last_name,score) VALUES('$first_name','$last_name','$score')";mysqli_query($dbc,$query)or die('error_2');$gpy=move_uploaded_file($_FILES['image_upload']['tmp_name'],$photo_dir.$_FILES['image_upload']['name']);echo 'Thanks for adding your new high score!
';echo 'FIRST_NAME:'.$first_name.'
';echo 'LAST_NAME:'.$last_name.'
';echo 'Score:'.$score.'
';echo '';echo '<<Back to hight score
';//clear the score data to clear the form$firet_name="";$last_name="";mysqli_close($dbc);}}?>
The error message shows Undefined Variables. what is the problem?
Reply to discussion (solution)
Let's take a look at lines 39 of addscore. php. your code won't be in addscore. php.
The server does not support uploading.
The uploaded file exceeds the post_max_size limit.
Let's take a look at lines 39 of addscore. php. your code won't be in addscore. php.
This code is addscore.
Let's take a look at lines 39 of addscore. php. your code won't be in addscore. php.
What does undefined index mean? Image_upload: the name of the uploaded image. why is it undefined?
Entype error
It should be enctype
Thanks very much. why is it obvious that the enctype is wrong, but the error is not defined by other variables?
Thanks very much. why is it obvious that the enctype is wrong, but the error is not defined by other variables?
$ _ FILES is an array containing $ _ FILES ['image _ upload']. the array member is incorrect. The $ _ FILES array is empty, the code behind you directly uses $ _ FILES ['image _ upload'], and the prompt is not defined. Besides, this prompt is a Notice.
Oh,
Thanks very much. why is it obvious that the enctype is wrong, but the error is not defined by other variables?
$ _ FILES is an array containing $ _ FILES ['image _ upload']. the array member is incorrect. The $ _ FILES array is empty, the code behind you directly uses $ _ FILES ['image _ upload'], and the prompt is not defined. Besides, this prompt is a Notice.
Thank you very much? I am learning php first. if I have any good information or learning methods, my major is not a computer. I can't find a way to learn it.
Oh,
Thanks very much. why is it obvious that the enctype is wrong, but the error is not defined by other variables?
$ _ FILES is an array containing $ _ FILES ['image _ upload']. the array member is incorrect. The $ _ FILES array is empty, the code behind you directly uses $ _ FILES ['image _ upload'], and the prompt is not defined. Besides, this prompt is a Notice.
Thank you very much? I am learning php first. if I have any good information or learning methods, my major is not a computer. I can't find a way to learn it.
There are a lot of online materials. I used to watch free courses, broadcast intelligence podcasts, brothers, and basic videos. I just need to practice more, errors such as wrong letters can be found at the beginning, so you can debug them slowly. I remember a trained teacher said, don't worry about errors, and debug them step by step, I can't check the information online, but I can't consult other people.
O =
Oh,
Thanks very much. why is it obvious that the enctype is wrong, but the error is not defined by other variables?
$ _ FILES is an array containing $ _ FILES ['image _ upload']. the array member is incorrect. The $ _ FILES array is empty, the code behind you directly uses $ _ FILES ['image _ upload'], and the prompt is not defined. Besides, this prompt is a Notice.
Thank you very much? I am learning php first. if I have any good information or learning methods, my major is not a computer. I can't find a way to learn it.
There are a lot of online materials. I used to watch free courses, broadcast intelligence podcasts, brothers, and basic videos. I just need to practice more, errors such as wrong letters can be found at the beginning, so you can debug them slowly. I remember a trained teacher said, don't worry about errors, and debug them step by step, I can't check the information online, but I can't consult other people.
Ask another question: are you working now or are you a student at school?
O =
Oh,
Thanks very much. why is it obvious that the enctype is wrong, but the error is not defined by other variables?
$ _ FILES is an array containing $ _ FILES ['image _ upload']. the array member is incorrect. The $ _ FILES array is empty, the code behind you directly uses $ _ FILES ['image _ upload'], and the prompt is not defined. Besides, this prompt is a Notice.
Thank you very much? I am learning php first. if I have any good information or learning methods, my major is not a computer. I can't find a way to learn it.
There are a lot of online materials. I used to watch free courses, broadcast intelligence podcasts, brothers, and basic videos. I just need to practice more, errors such as wrong letters can be found at the beginning, so you can debug them slowly. I remember a trained teacher said, don't worry about errors, and debug them step by step, I can't check the information online, but I can't consult other people.
Ask another question: are you working now or are you a student at school?
I have been working for three years.