Hi
Thanks to Vinay for your help
works very good...
But I cant 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="root";
$password="root";
$database="anda";
$con = mysql_connect("localhost",$username,$password);
mysql_select_db("$database", $con);
$str = $_GET['emailreader'];
$text=$_GET['emailreader'];
$spacecount=substr_count($text," ");
$emails_exploded=(explode(" ",$str));
$sql = "SELECT * FROM mailing";
$result = mysql_query($sql);
$array = mysql_fetch_array($result);
$mail = $array['mail'];
for ($i=0;$i<=$spacecount;$i++)
{
if($emails_exploded[$i] != $mail)
{
echo $emails_exploded[$i];
mysql_query("INSERT INTO mailing (mail)
VALUES('$emails_exploded[$i]')") or die(mysql_error());
}
}
}
?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="get" name="emailform">
<label for=email>Email</label>
<input type="text" name="emailreader" size="200" />
<input type="submit" name="submit" value="Ok !" />
<input type="hidden" name="trigger" value="6" />
<input type="reset" name="cancel" value="Cancel" />
</form>
</body>
</html>
Thanks a lot
+ _
// Emiliano Boragina _
// Diseño & Comunicación //////////////////
+ _
// [email protected] /
// 15 40 58 60 02 ///////////////////////////
+ _