php error

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

BandanaChaudhury
New php-forum User
New php-forum User
Posts: 22
Joined: Fri Jun 22, 2012 9:14 am

php error

Postby BandanaChaudhury » Thu Nov 01, 2012 8:08 pm

I am getting an error,
Notice: Undefined index: trip in C:\xampp\htdocs\Travelpoint.com\tdomestic.php on line 5.
And in line 5 it's written,
$trip = $_POST['trip'];
How to rectify it?

MeroD
New php-forum User
New php-forum User
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am

Re: php error

Postby MeroD » Thu Nov 01, 2012 9:06 pm

Use var_dump($_POST) to examine the variables/array sent to your script...

BandanaChaudhury
New php-forum User
New php-forum User
Posts: 22
Joined: Fri Jun 22, 2012 9:14 am

Re: php error

Postby BandanaChaudhury » Fri Nov 02, 2012 8:15 am

Then also same problem,
but now it is also displaying NULL after it.

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: php error

Postby seandisanti » Fri Nov 02, 2012 2:27 pm

You're accessing a property that doesn't exist in the context in which you're accessing it. specifically the 'trip' post element. make sure that isset($_POST) before acting upon post elements, and if you're still having issues, you've probably typo'd the name of the field in your form that is posting data to the page. For more specific help, post the code for the form (including the form tag) and/or the php code that is failing

BandanaChaudhury
New php-forum User
New php-forum User
Posts: 22
Joined: Fri Jun 22, 2012 9:14 am

Re: php error

Postby BandanaChaudhury » Sat Nov 03, 2012 10:59 pm

thank you,
it's solved now.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest