Forums

PHP

This topic is locked

Need help with mulitupdate dynamic Radio Buttons

Posted 02 Mar 2002 12:17:18
1
has voted
02 Mar 2002 12:17:18 Thorsten Roever posted:
Hi there,

I hope anyone can help me. I havn't got ideas anymore. (I use UD/Impakt)

At my Admin-Area I want to give me the ability to change a displayed Start-Image. For that I created an update-record-form using the "Dynamic-Radio-Buttons" and the "Repeat-Region-Behaviour". But here the problem begins: Normally you can use the "Dynamic-Radio-Buttons" if every Recordset of the table contains two or more Radio-Buttons. In my situation I only need one, in order. My english is very bad, sorry, I hope you understand my problem. It's like a typical "Multiupdate-Page", but instead a checkbox I use RadioButton.

The RadioButton should set the selected Column of the Recordset to "1" - all the others to "0" so that I can filter my ResultPage with "WHERE field == 1". I always get a SQL-Error near Line1. Here's my code:

<?php


// Copyright (c) Interakt Online 2001
// www.interakt.ro/

require("./../../adodb/adodb.inc.php";
require("./../../Connections/connFormgarten.php";
?>
<?php require_once(ADODB_DIR."/KTeditOps_declareVars.php"; ?>
<?php
$KT_numRows_myFlash = 6
?>
<?php
// *** Update Record: set variables

if (isset($MM_update) && (isset($MM_recordId))) {

//$MM_editConnection = $MM_connFormgarten_STRING;
$MM_editTable = "f2_flash";
$MM_editColumn = "ID";
$MM_recordId = "" . $MM_recordId . "";
$MM_editRedirectUrl = "/redaktion/flash/untitled.php";
$MM_fieldsStr = "freischalten|value";
$MM_columnsStr = "freischalten|',none,''";

// create the $MM_fields and $MM_columns arrays
$MM_fields = Explode("|", $MM_fieldsStr);
$MM_columns = Explode("|", $MM_columnsStr);

// set the form values
for ($i=0; $i+1 < sizeof($MM_fields); ($i=$i+2)) {
$MM_fields[$i+1] = $$MM_fields[$i];
}

// append the query string to the redirect URL
if ($MM_editRedirectUrl && $QUERY_STRING && (strlen($QUERY_STRING) > 0)) {
$MM_editRedirectUrl .= ((strpos($MM_editRedirectUrl, '?') == false)?"?":"&" . $QUERY_STRING;
}
}
?>
<?php
$KT_Connection = &$connFormgarten;
require_once(ADODB_DIR."/KTupdateRecord_query.php";
?>
<?php
$myFlash = $connFormgarten->Execute("SELECT * FROM f2_flash" or KT_DIE($connFormgarten->ErrorNo(),$connFormgarten->ErrorMsg());
$myFlash_numRows=0;
$myFlash__totalRows=$myFlash->RecordCount();
?>
<?php
$Repeat1__numRows = 6;
$Repeat1__index= 0;
$myFlash_numRows = $myFlash_numRows + $Repeat1__numRows;
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form ACTION="<?php echo $MM_editAction?>" METHOD="POST" name="takethisflash">
<table width="200" border="0" cellspacing="0" cellpadding="0">
<?php while (($Repeat1__numRows-- != 0) && (!$myFlash->EOF))
{
?>
<tr>
<td>
<input <?php If ($myFlash->Fields("freischalten" == "1" echo("CHECKED";?> type="radio" name="freischalten" value="1">
<?php echo $myFlash->Fields("name"?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php
$Repeat1__index++;
$myFlash->MoveNext();
}
?>
<tr>
<td>
<input type="submit" name="Abschicken" value="update">
</td>
</tr>
</table>
<br>
<input type="hidden" name="MM_update" value="true">
<input type="hidden" name="MM_recordId" value="<?php echo $myFlash->Fields("ID" ?>">
</form>
</body>
</html>
<?php
$myFlash->Close();
?>

Replies

Replied 03 Mar 2002 03:32:05
03 Mar 2002 03:32:05 Tim Green replied:
The way you are trying to use the Radio buttons, sounds to me, like normal useage.

If it isn't working, as you are using ImpAKT, I would seek support from Interakt (or report it as a bug at the Interakt Bug Tracker)....

All the best

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 03 Mar 2002 12:02:23
03 Mar 2002 12:02:23 Thorsten Roever replied:
Hi Tim, thank you. Okay I will try that way. Do you copy my code to understand what I mean? I'm not sure if my way is the right one I was trying.

Thanks,
Thorsten

Replied 03 Mar 2002 15:55:24
03 Mar 2002 15:55:24 Thorsten Roever replied:
Hi Tim and all the others,

I think the problem in I want to do is a multiple updating and not a bug in Impakt. You know with that repeat Region and the only one Radio Button that will be repeated for each Recorset I want to set just one Recordset (the selected) to "1", all the others at that special column in my table to "0". That would allow me to filter a result page by "WHERE field("image" ==1".

So I think it is a problem of multiple updating. I read all the topics about using Javascript to manage multiupdating, but to me, as a newbie, it sounds "spanish" to me <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Please, please gimme tip!

What about creating a multi Update/Delete Behaviout for the folks using Phakt/Impakt? I think they would pay for that.

Replied 03 Mar 2002 17:33:22
03 Mar 2002 17:33:22 Tim Green replied:
Thorsten,

No I didn't copy your code to check it. That is because I don't like "Here's my code, fix it" type posts...

The topic of multiple-updating has been dealt with SEVERAL times before. Please look through this forum, find the posts on Multiple-Updates and adapt the code you find.

Regards


Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic