undefined index errors - Help

I don’t know much about php but I’m trying to help a friend by building an order form for his company website. I utilized some free php code online to create the form code. I’m getting "undefined index errors on lines 8 through 23. Here are a few of those lines for your review. They are all set up the same but obviously there is a problem with the code. Any ideas?

$Storenumber = Trim(stripslashes($_POST[‘Storenumber’]));
$Name = Trim(stripslashes($_POST[‘Name’]));
$Street_address = Trim(stripslashes($_POST[‘Street_address’]));
$City_state = Trim(stripslashes($_POST[‘City_state’]));
$Zipcode = Trim(stripslashes($_POST[‘Zipcode’]));
$Csta_quantity = Trim(stripslashes($_POST[‘Csta_quantity’]));[/code]

“undefined index” isn’t a real error, but a notice. in this case it means that the fields havn’t been submitted.

i don’t know at what time that error cones up

eighther ist displayed befor the form is submitted: use isset()[php]
if(isset($_POST[‘Storenumber’])) {$Storenumber = Trim(stripslashes($_POST[‘Storenumber’]))}
else {/depends on what u wanna do/ $Storenumber = ‘’; /* maybe evern die(‘submittion faild, field missing’); */}[php]

or u have to check ur speelin incuding the case
or u try to use stripslashes() for some fields that are not in the form

Sponsor our Newsletter | Privacy Policy | Terms of Service