Outline ·
[ Standard ] ·
Linear+
PHP IT Request Form problem, using PHP and Laravel
SUSSpotTheBlue
|
Jan 15 2019, 09:53 AM, updated 6y ago
|
Getting Started
|
Hi, When I was trying to create the IT Request Form and testing it out, I got some problems during the testing. The home page (index.blade.php) ended up getting an error called "Undefined offset: 1", maybe due to the table database problem. The checkboxes in the Request Form (requestForm.blade.php) should not be all checked, instead the user has to select a checkbox option. Is there a way to fix the form? My IT Request Form project: https://drive.google.com/file/d/1Vpif_1Cxm-...iew?usp=sharing*Please note that the data I entered when testing is fictional (not real). This post has been edited by SpotTheBlue: Jan 15 2019, 09:55 AM
|
|
|
|
cordelialoo
|
Jan 15 2019, 10:07 AM
|
New Member
|
Sean,
why must you trim empty field? you forcing it to trim undefined field? why not use if else to check if the field is true or false first?
|
|
|
|
danieln
|
Jan 15 2019, 10:19 AM
|
|
Undefined offset - this could happen when you are trying to refer to values in an array but its not available.
if it's on your 'get' pages, then try removing all the variables and then add back one by one to see which is causing the error.
|
|
|
|
SUSSpotTheBlue
|
Jan 15 2019, 10:20 AM
|
Getting Started
|
QUOTE(cordelialoo @ Jan 15 2019, 10:07 AM) Sean, why must you trim empty field? you forcing it to trim undefined field? why not use if else to check if the field is true or false first? Where's the empty field?
|
|
|
|
WongGei
|
Jan 15 2019, 01:05 PM
|
|
Undefined offset - $matches[1],$matches[2] This error will happen when you have no matches. Try to check the size of matches before using it can avoid this error.
|
|
|
|
SUSSpotTheBlue
|
Jan 16 2019, 02:25 PM
|
Getting Started
|
I've already almost perfected the form, But the problem is the checkboxes. When I tested out the checkboxes, I clicked the checkboxes, when registered, the value will be 0 (disabled) even when unchecked. I also tested out to update the "Backup & Restore" details, but nothing happens, thinking I'm sending the NULL value. Updated version: https://drive.google.com/file/d/1Vpif_1Cxm-...iew?usp=sharing
|
|
|
|
brkli
|
Jan 18 2019, 03:29 PM
|
|
1. You can disable E_NOTICE and this will go away. hey, it is just a notice.
2. The correct way it to check $matches, whether is it empty array or not via using count. if $matches are empty, you should just assign $iteratee and $iteration a default value.
|
|
|
|