It's more of a basic php issue than a pdo issue, but none the less I am getting error 'Notice: Undefined index: body in /home/downlowd/www/dev/launch.php on line 20'
I tried to pass $_POST
in a few places, but just made things worse.
<?php
require_once('config.php');
$attrs = array(PDO::ATTR_PERSISTENT => true);
$pdo = new PDO("mysql:host=localhost;dbname=".$dbname, $db_username, $db_password, $attrs);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$custlist = $pdo->prepare("SELECT * FROM customer_list");
$carrierlist = $pdo->prepare("SELECT * FROM carriers");
//$products = array();
$smsarrayobject = new ArrayObject($carrierlist);
if ($custlist->execute()) {
while ($row = $custlist->fetch(PDO::FETCH_ASSOC)) {
$prefix = $row['sms_num'];
if ($carrierlist->execute()) {
while ($rows = $carrierlist->fetch(PDO::FETCH_ASSOC)) {
$from = 'admin@telecomm.com';
$to = $prefix.$rows['carrieraddr'];
$body = $_POST['body'];
mail($to, $from, $body);
}
}
}
}
$pdo = null;
?>
<form action="" method="POST">
Your Message Body <input name="body" type="text" />
<input type="submit">
</form>