hi there all
first - complete newbie here flying by the seat of my pants and learning php from scratch by diving into the deep end first...

i got a database of music tracks in mysql - got a search form to search and display selected tracks and got an ajax based data grid to update records (using Drastic Tools) - so far so good

now let's say i have a column called Keywords (keywords that describe the music track) in a table called MusicTracks - i have also a table of predefined keywords (KeywordsTable with a field called KeywordChoices and each record holds a value like 'urban' 'house' 'calm' 'dreamy' 'chilled' etc)
what i am looking to create is a form that will call a track from MusicTracks and have a multiply choice box populated with the values from KeywordsTable which i can select/deselect and than on submit will update the keywords field in the MusicTracks with a string of the selected words (with a space between each one)
is there anyone who might be able to put some suggestion of how to construct this form?

It's a bit difficult to guess what you are trying to do, but it actually sounds a little like the post I've just made a few minutes ago "Form not posting to database".
My form is a series of checkboxes in a column that are cross referenced to radio buttons with predetermined values.

It's a bit difficult to guess what you are trying to do, but it actually sounds a little like the post I've just made a few minutes ago "Form not posting to database".
My form is a series of checkboxes in a column that are cross referenced to radio buttons with predetermined values.

Hi there and thanks for your reply
i have looked at your posting and as far as i can understand it each of your checkable values is a boolean field of it's own - what am i looking for is to have all these values in one field as a string of words separated by comma or space and than the form reads this string and breaks it into separate values which i canchec/uncheck or select in a combobox and than update the record with all selected values back into the one field

I can send (email) a screenshot of my page as generated for the form. It's working OK for me and I'm stoked.
What I wanted to do was to display a list of students (their names are pulled from the database as an array) and then I can check a selection of them and post that selection in association with data held by one of the several radio buttons. So it's not Boolean, and could easily be converted from the array. I think it's probably something like you are looking for, and I should mention that the code was working all along, but I had a typo in one of the field names.
If you have an email in your profile I'll send the screenshot if you want.

thank you again! will be glad to look at your form to see if it is what i am looking for
i guess if i was to give an example it will be like that
let's say there is a database record i want to update - it has 2 fields SongName and Keywords - the specific entry name is 'Song1' and the Keywords field is:
'fast, house, energetic, tense' (all predefined keywords)
now when loading this entry into the update form it should have all predefined keywords with checkboxes by them and the keywords already in will be checked - than i can uncheck 'tense' and check 'antheme' and that should update the keywords field to:
'fast, house, energetic, antheme'

I have made an example of what i am looking for using Zoho online database
http://memimomedia.com/zoho.html
the top bit is a submit form, the bottom is a editable grid
what i would like is something similar to the multi choices box

Member Avatar for diafol

Your example looks OK. Are you limiting your keywords to a dropdown/listbox? What if you want to add a new keyword? Have you thought about a series of suggest boxes (say 6??) for adding keywords? If you are storing song keywords as a single string, you can simply catentate the textbox keywords.

However, your autosuggest will not show any new terms unless you have a unique keywords table and you check + add any new words to it.

the problem with my example is that it relies on zoho for backbone - i would prefer having a similar form intefacing with a mysql database so i can move it around without concern of relying on propriety backbone but i have not enough knowledge to build work out how to write a code for a multi choice box both for reading of the table and updating...
i thought i could have a separate table of keywords which i can always add to.
in any case i need some example code for something similar to learn how to do this - at the moment i have tried two different codes (DrasticTools and PHPMyDataGrid) both work for everything else but can't figure how to make a multi-selection box and put it in

Member Avatar for diafol

Fraid I don't know anything about zoho. Good luck though.

ok have made some progress in my knowledge and at the moment (after addapting someone else's script) i have this 2 scripts:

<?php
$record = $_POST['searchdata'];
echo "Reference: $record<br><BR>";


//Connecting to MYSQL
MySQL_connect("localhost","USER","PASS");

//Select the database we want to use
mysql_select_db("TABLE") or die("Could not find database");

$result=mysql_query(" SELECT * FROM ppl_tracks WHERE Track='$record'");
$num=mysql_num_rows($result);
$i=0;
while ($i < $num) {

// collect all details for our one reference
$Description=mysql_result($result,$i,"Description");
$Artist=mysql_result($result,$i,"Artist");
$reference=mysql_result($result,$i,"Track");
$FileName=mysql_result($result,$i,"FileName");
$Keywords=mysql_result($result,$i,"Keywords");
$Mood=mysql_result($result,$i,"Mood");
$Composed=mysql_result($result,$i,"Composed");
$ID=mysql_result($result,$i,"RECNO");


?>

<TABLE WIDTH="100%" CELLPADDING="10" CELLSPACING="0" BORDER="2"> <TR ALIGN="center" VALIGN="top"> 
<TD ALIGN="center" COLSPAN="1" ROWSPAN="1" BGCOLOR="#F2F2F2">

<FORM ACTION="amend2.php" METHOD="post"> 
<P ALIGN="LEFT">
<INPUT TYPE="hidden" NAME="ud_id" VALUE="<? echo "$ID" ?>"> 
<BR>Description1:<BR><TEXTAREA NAME="ud_Description" COLS="50" ROWS="4">
<? echo "$Description"?></TEXTAREA></P><P ALIGN="LEFT">Artist:<BR>
<TEXTAREA NAME="ud_Artist" COLS="50" ROWS="4"><? echo "$Artist"?></TEXTAREA></P><HR><B> 
</B><P ALIGN="LEFT">Thumbnail:<BR> <INPUT TYPE="text" NAME="ud_FileName" VALUE="<? echo "$FileName"?>" SIZE="30" MAXLENGTH="50"></P><P ALIGN="LEFT">Image 
1 :<BR> <INPUT TYPE="text" NAME="ud_Keywords" VALUE="<? echo "$Keywords"?>" SIZE="30" MAXLENGTH="50"></P><P ALIGN="LEFT">Image 
2 :<BR> <INPUT TYPE="text" NAME="ud_Mood" VALUE="<? echo "$Mood"?>" SIZE="30" MAXLENGTH="50"></P><P ALIGN="LEFT">Image 
3 :<BR><INPUT TYPE="text" NAME="ud_Composed" VALUE="<? echo "$Composed"?>" SIZE="30" MAXLENGTH="50"><BR><BR> 
</P><P><INPUT TYPE="Submit" VALUE="Update the Record"> </P></FORM></TD></TR></TABLE>

<?
++$i;
}
?>

and amend2.php:

<?php

$ud_id=$_POST['ud_id'];
$ud_Description=$_POST['ud_Description'];
$ud_Artist=$_POST['ud_Artist'];
$ud_FileName=$_POST['ud_FileName'];
$ud_Keywords=$_POST['ud_Keywords'];
$ud_Mood=$_POST['ud_Mood'];
$ud_Composed=$_POST['ud_Composed'];

$con = mysql_connect("localhost","USER","PASS");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("Table", $con);
echo "<BR>Record $ud_Description <-- Updated<BR><BR>";

mysql_query(" UPDATE ppl_tracks
SET Description='$ud_Description' WHERE RECNO = '$ud_id'");

echo "<BR>Record $ud_id <-- Updated<BR><BR>";
mysql_close($con);
?>

it works fine as is

now for the form i want to replace the text input area for ud_Mood iwth a Multiple Selection Box - i know how to add a selection box but not sure how to get it reading the values of $Mood

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.