Click to See Complete Forum and Search --> : OOP poll new problem :S


gwdtjuh
04-15-2004, 05:57 AM
Hello (again),

When i'm on the admin page and i fill in my question and answers and i press the submit button he only seems to save the question where the answers remain the same.

This is what is used to save (srry it's in dutch):

function opslaan () //Create function save
{
$db = new database();
$db->uitvoeren("UPDATE vraag SET vraag='$_POST[vraag]' WHERE id='$_POST[id]'");
$db->uitvoeren("UPDATE antwoord SET antwoord='$_POST[antwoord]' WHERE id='$_POST[antwoord_id]'");
}

This is what is in my template for the answers:

<input type="HIDDEN" name="antwoord_id[]" value="<#id#>">
<input type="TEXT" name="antwoord" size="50" value="<#antwoord#>">


I think i have to do something with $_POST[antwoord_id] but i can't figgure out what.

manny thx in advance... hope u know more of php then me ;)

Nevermore
04-15-2004, 06:26 AM
function opslaan ()
{
$vraag=$_POST['vraag'];
$ant=$_POST['antwoord'];
$id=$_POST[antwoord_id];
$db = new database();
$db->uitvoeren("UPDATE vraag SET vraag='$vraag' WHERE id='$_POST[id]'");
$db->uitvoeren("UPDATE antwoord SET antwoord='$ant' WHERE id='$id' ");
}


You also seem to have a naming problem, with your field called antwoord_id[] and you referencing antwoord_id, so you need to rename the field.

Give that a go.

gwdtjuh
04-15-2004, 06:35 AM
thx that what one problem of it...
it seems to store now... but only in the first answer...