Jump to content

Recommended Posts

Hi,

 

I've got a form setup, Where the user can tick to make the car they are adding to the site Car Of The Week... This will then input a value of 1 into the Database.

 

That works when the box is ticked, But when its not ticked I'm getting PHP Errors of the variable being undefined... How do I change that undefined to a 0?

 

<form action="addcar.php" method="post" enctype="multipart/form-data">
<h2>Add a new car</h2>               
<ul>
<li><label>Car Name : </label><input type="text" name="carname" tabindex="1" /></li>
<li><label>Cars' Description : </label><textarea name="description" cols="40" rows="5" tabindex="2"></textarea></li>
<li><label>Price : </label><input name="carsprice" type="text" tabindex="3" id="carsprice" />
<li>
<li><label>Feature 1 : </label><input name="feature1" type="text" tabindex="4" /><em>Car feature i.e ABS</em></li>
<li><label>Feature 2 : </label><input name="feature2" type="text" tabindex="5" /><em>Car feature i.e ABS</em></li>
<li><label>Feature 3 : </label><input name="feature3" type="text" tabindex="6" /><em>Car feature i.e ABS</em></li>
<li><label>Feature 4 : </label><input name="feature4" type="text" tabindex="7" /><em>Car feature i.e ABS</em></li>
<li><label>Feature 5 : </label><input name="feature5" type="text" tabindex="8" /><em>Car feature i.e ABS</em></li>
<li><label>Image 1 : </label><input name="image1" type="file" /><em>* This is the main image that will appear on the site</em></li>
<li><label>Image 2 : </label><input type="file" name="image2" /></li>
<li><label>Image 3 : </label><input type="file" name="image3" /></li>
<li><label>Image 4 : </label><input type="file" name="image4" /></li>
<li><label>Make Car Of The Week : </label><input name="caroftheweek" type="checkbox" value="1" />
</li>
<li>
<input type="submit" name="submit" id="submit" value="Submit" />
<input type="reset" name="reset" id="reset" value="Reset" />
</li>
</ul>
</form>

 

The Form Field is titled caroftheweek

 

Cheers :)

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.