I am getting an array error, now it is still sending the email, and displaying the message(of course i would really like it to be handled all on the same html page not a separate page, but I can not figure out what the error is…
any help would be appreciated, I haven’t worked with php in 10? years so you can call me a newb again.
warning
Warning: Undefined array key "message" in /var/www/vhosts/ on line 15
Warning: Undefined array key "message" in /var/www/vhosts/ on line 16
Mail Sent. Thank you Chris, we will contact you shortly.
php code:
<?php
if(isset($_POST['submit'])){
$to = "removedemail"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$vendor = $_POST['vendor'];
$bname = $_POST['bname'];
$web = $_POST['web'];
$wares = $_POST['wares'];
$phone = $_POST['phone'];
$madd = $_POST['madd'];
$bsize = $_POST['bsize'];
$event = $_POST['event'];
$subject = "event Application";
$subject2 = "Copy of your form submission";
$message = $vendor . " " . $bname . " wrote the following:" . $vendor . "Vendor Name:" . $bname . "Booth Name:" . $web . "Websire Adress:" . $wares . "What do you sell:" . $phone . "What is your Phone Number" . $madd . "What is your Mailing Address" . $bsize . "Booth size you want" . $event . "What event do you want to attend" . "\n\n" . $_POST['message'];
$message2 = "Here is a copy of your message " . $vendor . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Mail Sent. Thank you " . $vendor . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>
html code:
<form class="form-horizontal" method="post" action="/wapp.php" target="_blank">
<fieldset>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="vendor"></label>
<div class="col-md-5 col-xl-8">
<input id="vendor" name="vendor" type="text" placeholder="Vendor name" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="bname"></label>
<div class="col-md-4 col-xl-8">
<input id="bname" name="bname" type="text" placeholder="Booth Name" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email"></label>
<div class="col-md-4 col-xl-8">
<input id="email" name="email" type="text" placeholder="Email" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="web"></label>
<div class="col-md-4 col-xl-9">
<input id="web" name="web" type="text" placeholder="Website(optional)" class="form-control input-md">
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="wares"></label>
<div class="col-md-4 col-xl-11">
<textarea class="form-control" id="wares" name="wares">Describe Your Wares</textarea>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="phone"></label>
<div class="col-md-4 col-xl-5">
<input id="phone" name="phone" type="text" placeholder="Phone Number" class="form-control input-md" required="">
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="madd"></label>
<div class="col-md-4 col-xl-11">
<textarea class="form-control" id="madd" name="madd">Mailing Address</textarea>
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="bsize"></label>
<div class="col-md-4 col-xl-6">
<select id="bsize" name="bsize" class="form-control">
<option value="1">10x10 Booth(75.00)</option>
<option value="2">10x20 Booth(100.00)</option>
</select>
</div>
</div>
<!-- Multiple Radios -->
<div class="form-group">
<label class="col-md-4 control-label" for="event"></label>
<div class="col-md-4 col-xl-5">
<div class="radio">
<label for="event-0">
<input type="radio" name="event" id="event-0" value="1" checked="checked">
Faire Weekend
</label>
</div>
<div class="radio">
<label for="event-1">
<input type="radio" name="event" id="event-1" value="2">
Pirates Weekend
</label>
</div>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-4">
<button id="submit" name="submit" class="btn btn-success">Submit Application</button>
</div>
</div>
</fieldset>
</form>