Jump to content

Recommended Posts

Good Morning!

I have downloaded and begun to experiment with baaGrid (great 'script'! and easy to make it do most of what I need).

Retrieving and display the data desired is quick and easy; however, I have a need to be able to display the grid as editable 'records/fields' [ie add/edit/delete].

I was hoping our mentor Barand (who tho he may be approaching senility is still younger than me) might shed some light (no pun on my name intended) in the fashion of the '** For Dummies' series.

(btw this is for a project to be used to encourage children k - 12 to read)

Thanks Much,

Lite
(nick)
Link to comment
https://forums.phpfreaks.com/topic/22248-baagrid-editable-records/
Share on other sites

I'm not quite sure why you're posting instead of emailing him.  Also, if you want to make the grid editable, I'm not sure how that has anything to do with his scripts.  That is functionality beyond what he has provided and should be directed to those who can help with code you might have already begun to work with.
  • 2 weeks later...
I've just seen this post. There is an example using checkboxes with class. Currently it's not an inbuilt feature but you could do

[code]
<?php
include 'db.php';
include 'baagrid.php';

if (isset ($_GET['action'])) {
    echo '<pre>', print_r($_GET, true), '</pre>';
}

$sql = "SELECT id, locname, qty FROM baagriddata";
$grid = new baaGrid($sql);
echo '<form>';
$grid->setGPCol (1, "<input type='text' size = '15' name='locname[#0]' value='#1'>");
$grid->setGPCol (2, "<input type='text' size = '5' name='qty[#0]' value='#2'>");
$grid->display();
echo '<input type="submit" name="action" value="Submit">' ;
echo '</form>';
?>
[/code]
... or this, which lets you select an individual line to edit

[code]
<?php
include 'db.php';
include 'baagrid.php';

if (isset ($_GET['action'])) {
    echo '<pre>', print_r($_GET, true), '</pre>';
}

function formField ($name, $size, $value, $id) {
    if ($id == $_GET['editid'])
        return "<input type='hidden' name='id' value='$id'>
                <input type='text' size = '$size' name='$name' value='$value'>";
    else
        return $value;
}

$sql = "SELECT id, locname, qty, 'edit' as Edit FROM baagriddata";
$grid = new baaGrid($sql);
echo '<form>';
$grid->setGPCol (1, "formField('locname',15,#1, #0)");
$grid->setGPCol (2, "formField('qty',5,#2, #0)");
$grid->setLink(3,"$_SERVER[PHP_SELF]?editid=#0");
$grid->showErrors();
$grid->display();
echo '<input type="submit" name="action" value="Submit">' ;
echo '</form>';

?>
[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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