implode function-error?
Posted: Mon Feb 15, 2010 1:37 pm
I have built a simple submit form, trying to understand how implode works. The form dumps the data to the database correctly, but gives me a error of
It is telling me the error is on this line: $string = implode(', ', $user_email);
Also, I have used both POST and REQUEST with the same error returning
My code is this:
Can someone see what my problem may be. It works terrific, but I get the dang error. I have searched and tried everything. I'm not a php guru, so please explain fully!! THanks a ton.Warning: implode() [function.implode]: Invalid arguments passed in /
It is telling me the error is on this line: $string = implode(', ', $user_email);
Also, I have used both POST and REQUEST with the same error returning
My code is this:
Code: Select all
<?php
$user_email = $_REQUEST['user_email'];
$string = implode(', ', $user_email);
$user_name = $_REQUEST['user_name'];
if (isset($_REQUEST['Submit'])) {
# INSERT THE DATA FROM THE FORM INTO MYSQL TABLE
$sql = "INSERT INTO $db_table(user_name,user_email) values ('$user_name','$string')";
if($result = mysql_query($sql ,$db)) {
echo '<h1>Thank you</h1>Your information has been entered into our database<br><br';
} else {
echo "ERROR: ".mysql_error();
}
} else {
?>
<h1>How To Use the Implode Function- trial, not working!</h1><hr>
<form method="post" action="">
<p>Name:<br>
<input name="user_name" type="text" size="30">
<br>
Email: <br><input name="user_email[]" type="checkbox" id="user_email[]" value="red" />
Red
<input name="user_email[]" type="checkbox" id="user_email[]" value="blue" />
Blue
<input name="user_email[]" type="checkbox" id="user_email[]" value="green" />
Green
<input name="user_email[]" type="checkbox" id="user_email[]" value="yellow" />
Yellow
<br>
<input type="submit" name="Submit" value="Submit">
</p>
</form>