Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

PHP IT Request Form problem, using PHP and Laravel

views
     
SUSSpotTheBlue
post Jan 15 2019, 09:53 AM, updated 6y ago

Getting Started
**
Junior Member
50 posts

Joined: Mar 2016
From: Shah Alam


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.

user posted image

The checkboxes in the Request Form (requestForm.blade.php) should not be all checked, instead the user has to select a checkbox option.

user posted image

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
post Jan 15 2019, 10:07 AM

New Member
*
Newbie
44 posts

Joined: Mar 2014
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
post Jan 15 2019, 10:19 AM

Regular
******
Senior Member
1,249 posts

Joined: Feb 2008
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
post Jan 15 2019, 10:20 AM

Getting Started
**
Junior Member
50 posts

Joined: Mar 2016
From: Shah Alam


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
post Jan 15 2019, 01:05 PM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
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
post Jan 16 2019, 02:25 PM

Getting Started
**
Junior Member
50 posts

Joined: Mar 2016
From: Shah Alam


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
post Jan 18 2019, 03:29 PM

On my way
****
Junior Member
539 posts

Joined: Oct 2018
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.

 

Change to:
| Lo-Fi Version
0.0148sec    0.10    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 06:05 AM