remove a ; from emails in textarea


Posted on 16th Feb 2014 07:03 pm by admin

Code: <?php

session_start();

Did you know?Explore Trending and Topic pages for more stories like this.
$database_host = "localhost";
$database_username = "";
$database_password = "";
$database_name = "";

$connection = mysql_connect($database_host, $database_username, $database_password) or die(mysql_error());
$db = mysql_select_db($database_name, $connection);

if(!$_POST)
{

echo "<FORM METHOD=POST ACTION=$PHP_SELF>";
echo "<TEXTAREA NAME=my_textarea COLS=30 ROWS=5></TEXTAREA><BR>";
echo "<INPUT TYPE=SUBMIT VALUE=Submit>";
echo "</FORM>";

}
else
{

$entries = explode( "n", $_POST[my_textarea]);

$x=0;

foreach($entries AS $entry)
{

if($entry!=="")
{

$register_sql = "INSERT INTO emails(emails_email) VALUES ('$entry')";
$register_row = mysql_query($register_sql);

echo "$entry added to database
";
$x++;

}

}

}

?>
i have the above code, where you enter emails in a textarea like

email1@hotmail.com
email2@hotmail.com

and then it will put them into my database.

right now what i want to do is adapt the above code to do the same when you put emails in the textarea like..

email1@hotmail.com; email2@hotmail.com

thanks in advance
No comments posted yet

Your Answer:

Login to answer
187 Like 51 Dislike
Previous forums Next forums
Other forums

Export hangs
Hi all, please help

I have a Oracle 10.2.0.3.0 database. When I want to query the dba_segmen

URL Rewrite issue
Im created a series of Rewrites and on page checks to make sure the correct url is being called. But

why isn't this PHP code working ???
it's suppose to find a name on the database.

<?php

$s = $_POST["lname&

DELETE FROM not working deletes wrong row
Hello

I have the following code which i found but it doesnt work properly.. it comes up with

gmdate() - want 1 hr before time
Hi,
I am using php gmdate().
Now I am entering all dates in my dbase using gmdate("Y-m-d

getting weird error..
okay, I'm getting an error on this particular function, something about the syntax in the mysql LIMI

Find occurences of unicode characters in string
I need to prohibit filenames with everything but English characters and numbers but regexp and strin

Using Windows message as a Handle
Hi,

I am writing one of my first multithreaded programs.

In one of the thread,

Form always sends to error page...
Hello,
Any help will be greatly appreciated. I am having trouble getting multiple fields to be re

Inserting into MySQL Newbie
Hi ive got a slight problem where ive made a simple web form where the customer inserts the ammount

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash