SirFirekicker
-
Posts
7 -
Joined
-
Last visited
Never
Posts posted by SirFirekicker
-
-
[quote author=wildteen88 link=topic=101461.msg401634#msg401634 date=1153571132]
Try,
$meny = implode('-', $_POST['meny']);
then use $meny within your query:
ysql_query("INSERT INTO adminmeny (user, datum, meny) values ('" .$_POST['user']. "', '$datum', '" .$meny. "' )") or exit(mysql_error());
[/quote]
Nothing is inserted..
my checkboxes:
<input name="meny" type="checkbox" id="sidor" value="1">
<input name="meny" type="checkbox" id="nyheter" value="2"> -
separeted by -
-
I want to put the values of all the checked checkboxes into 'meny'
-
oops
of course I mean 'checkbox1' - 'checkbox2' - 'checkbox3' -
I want the values from my checkboxes to be put in my 'meny'
'checkbox1' - 'checkbox2' - 'checkbox2' so it puts in: 'checkbox1' - 'checkbox2' - 'checkbox2' example 1 - 2 - 3 (if 1,2,3 is the values)
mysql_query("INSERT INTO adminmeny (user, datum, meny) values ('" .$_POST['user']. "', '$datum', '" .$_POST['meny']. "' )") or exit(mysql_error()); -
Hello!
I have a problem with a form that saves into a mysql table..
The thing is I want to have 2 checkboxes example 1 and 2
And I have a hidden field named test and I want the value of this hidden field to be " 'checkbox1' - 'checkbox2' "
Because its the hidden field thats been sent to mysql table.
How do I do that ??
Sincerely, Johan
Help!! form to mysql
in PHP Coding Help
Posted
So why dont you use somthing liek this?
[code]Blue: <input type="checkbox" name="color[]" value="Blue">
Red: <input type="checkbox" name="color[]" value="Red">
Yellow: <input type="checkbox" name="color[]" value="Yellow">[/code]
second page that info is submitted to
[code]
<?php
foreach($_POST['color'] as $color) {
$colors=$colors.' - '.$color;
}
mysql_query("INSERT INTO adminmeny (user, datum, meny) values ('" .$_POST['user']. "', '$datum', '" .$colors. "' )") or exit(mysql_error());
?>
[/code]
I just used colors as an example but that *should* work basicaly color[] makes the checkboxes into an array and the foreach taks each ticked checkbox value and adds it to the variable $colors
Regards
Liam
[/quote]
That worked!! THANKS!!