Jump to content

Form CHECKBOX Error


ded

Recommended Posts

I know this is probably a simple fix.

 

I have 4 checkboxs on the form:

<input name="chalking" type="checkbox" value="Y" />
                    Chalking<br />
                    <input name="setup" type="checkbox" value="Y" />
                    Monday Setup Crew<br />
                    <input name="teardown" type="checkbox" value="Y" />
                    Sunday Tear Down Crew<br />
                    <input name="ticketbooth" type="checkbox" value="Y" />
                    Ticket/Booth

 

If I check all 4 boxes, the post.php works fine.

 

If I check anything less, if receive an error.

Notice: Undefined index: chalking in /home1/website/public_html/web/help/postindiv.php on line 10

 

Notice: Undefined index: ticketbooth in /home1/website/public_html/web/help/postindiv.php on line 13

 

 

$chalking = $_POST['chalking'];
$setup = $_POST['setup'];
$teardown = $_POST['teardown'];
$ticketbooth = $_POST['ticketbooth'];

Any ideas?

Link to comment
Share on other sites

You've got strict mode enabled - nothing to worry about.

 

You can suppress the notice by using this:

$chalking = @$_POST['chalking'];

 

Or redefine error reporting using this:

error_reporting(E_ALL ^ E_NOTICE);

That will allow error messages to get through but disable those notices. That notice you're getting just means you're checking something before it has been defined. In this case $_POST['chalking'] (and the other one) won't always be defined.

Link to comment
Share on other sites

Well basically on one of my contact forms I have:

 

@mail($to,$subject,$message,$headers);

 

I have this because I usually test on my localhost machine, which does not have an smtp function.

 

Without the @ symbol I was getting the error message on screen, so I put the @ symbol in as I thought it was used to check if there is a mail server present.

 

But it's clear now, it's still trying to send the message but just not displaying the error anymore... how can I tell it not to try and send an email if there is no mail server defiined?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.