------=_NextPart_000_0056_01CA3D7D.260C5830
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi=85
Thanks to Vinay for your help=85 works very good...
But I can=92t validate if one or more of the emails insert in the =
textarea
exist in the table of the DB to not insert it, but yes insert the others
mails that not exist in the db.
This the cod:
<html>
<head>
<title>Explode trial</title></head>
<body>
<?php
if($_GET['emailreader'])
{
$username=3D"root";
$password=3D"root";
$database=3D"anda";
$con =3D mysql_connect("localhost",$username,$password);
mysql_select_db("$database", $con);
$str =3D $_GET['emailreader'];
$text=3D$_GET['emailreader'];
$spacecount=3Dsubstr_count($text," ");
$emails_exploded=3D(explode(" ",$str));
$sql =3D "SELECT * FROM mailing";
$result =3D mysql_query($sql);
$array =3D mysql_fetch_array($result);
$mail =3D $array['mail'];
for ($i=3D0;$i<=3D$spacecount;$i++)
{
if($emails_exploded[$i] !=3D $mail)
{
echo $emails_exploded[$i];
mysql_query("INSERT INTO mailing (mail)
VALUES('$emails_exploded[$i]')") or die(mysql_error());
}
}
}
?>
<form action=3D"<?php $_SERVER['PHP_SELF'] ?>" method=3D"get" =
name=3D"emailform">
<label for=3Demail>Email</label>
<input type=3D"text" name=3D"emailreader" size=3D"200" />
<input type=3D"submit" name=3D"submit" value=3D"Ok !" />
<input type=3D"hidden" name=3D"trigger" value=3D"6" />
<input type=3D"reset" name=3D"cancel" value=3D"Cancel" />
</form>
</body>
</html>
Thanks a lot
+ =
_
// Emiliano Boragina _
// Dise=F1o & Comunicaci=F3n //////////////////
+ =
_
// emiliano.boragina [at] gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ =
_
------=_NextPart_000_0056_01CA3D7D.260C5830--
