Jump to content

This array/string error using the <select> html list option


28rain

Recommended Posts

From this code

<P><strong>Categorie</strong><br>
<select name = "categorie">
<option value = "watch">watch</option>
<option value = "piercing">piercing</option>
<option value = "my_music">my_music</option>
</select>

onto here (it is definetly posting because all other variables are ill show you full scripts if necessary)

 

$table = "$_POST[categorie]";
$db_name = "testDB";
$table_name = "$table";

 

and i get this error;

Notice: Array to string conversion in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\do_addrecord.php on line 6

Table 'testdb.array' doesn't exist

 

And my_music is definetly a table and i have added data to it previously

Thanks

 

ok error on line 14 now (you can see first line) cant see what the problem is. Its the same error...

<?
if((!$_POST['id'])||(!$_POST['format'])||(!$_POST['title'])){
header( "Location: /show_addrecord.html");
exit;
}
$table = $_POST["categorie"];
$db_name = "testDB";
$table_name = $table;
$connection = mysql_connect("127.0.0.1", "****", "*****)
or die(mysql_error());
$db = mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "insert into $table_name
(id, format, title, artist_fn, artist_ln, rec_label, my_notes, date_acq) VALUES
('$_POST[id]', '$_POST[format]', '$_POST[title]', '$_POST[artist_fn]',
'$_POST[artist_ln]', '$_POST[rec_label]', '$_POST[my_notes]', '$_POST[date_acq]')"; 
$result = mysql_query($sql,$connection) or die(mysql_error());
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.