Jump to content

Recommended Posts

how can i seperate a form input with that contains , and then insert into a database (i can do this bit).

 

this is what i have so far. I tried exploding it, but if it is in an array how can i insert it into the db.

 

if(isset($_POST['send']))
{
$to = $_POST['to'];

}
?>
<!--<div id="title"><img src="title.jpg" alt="Title"></div>-->
<div id="nav"></div>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" class="email">
To <input type="text" value="<?php echo $to; ?>" name="to" size="100" onClick="this.value=''" title="Enter The Recipients Email Address">
</form>

Link to comment
https://forums.phpfreaks.com/topic/112370-solved-mail-help/
Share on other sites

but what I'm telling you is that in your form you only have one thing being submitted...so..I don't really see what you're trying to make a comma separated list out of...in other words..what are you trying to explode? What data/variable/whatever are you working with? Because you haven't provided that...

Link to comment
https://forums.phpfreaks.com/topic/112370-solved-mail-help/#findComment-576933
Share on other sites

Okay, well, if you really are wanting variables to be named what's in your comma separated list like that:

<?php
$to = "one,two,three";
// i need to split one,two,three into
$list = explode(',',$to);
foreach($list as $val) {
 $$val = $val;
}
// example: 
echo $one; // echoes 'one'
?>

 

however... I have a sneaking suspicion that your list is of emails, right? Well that's not going to really work out with emails.  So...why can't you use an array?

Link to comment
https://forums.phpfreaks.com/topic/112370-solved-mail-help/#findComment-576944
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.