Login Retreive lost passwordRegister
Search

Forum Index / General / how to preset a $id for DbUpdate.

[ This topic is solved ]

  Lahousse Didier 02 January 06 / 11:56  
Changed at 02 January 06 / 12:11
I wan't my code to chose the row "$id", and not to take the URL $id.

$form->dbInfo ( $dbname, "my_user_table" );
$form->dbConnect( $dbhost, $dbuser, $dbpasswd );

$form->textField( $lang["nickname"], "user_name", FH_STRING, 20, 20);
$form->textField( ...
$form->textField( ...
$form->textField( ...

tt works perfect, but i want to proceed with a prticular "$id". I did try to pout $id = "" anywhere, ut doesn't work. Any idea ?

Is it possible to change value in :

["_id"]=>
array(1) {
[0]=>
string(5) "10002"
}

????



Did i says that i'm new to FormHandler ? ;)

  Teye Heimans (Founder) 02 January 06 / 12:13  
you can fake an ID in the URL by setting it in the variable

$_GET['id'];

So,

$_GET['id'] = $your_id;

By this way, you can let FormHandler know that you want to change a record but not trough the URL.

I hope I've understood your question right. If not, please post again.

  Lahousse Didier 02 January 06 / 12:16  
You did ! ;)

I was thinking about :

function dbSetId( $id ) {
require_once( FH_YADAL_DIR . 'class.Yadal.php' );
$this->_id = $id
}

then in my php page.

$form->dbSetId( $id );

May be you should think about it for a new release ?

  Recmo D. 29 May 09 / 18:11  
Wonderfull thing this forum... :)
I was looking for exactly the same thing!

Indeed... This code works fine:
$_GET['id'] = $your_id;

Now I can set the ID myself and not let anyone f*ck up the URL.

But... I kind of like the function dbSetId more...
Not that the above doesn't work but I think the function dbSetId is more of a clean kind of programming. The $_GET array is not to be edited by us (my humble opinion).

  Top


powered by PHP-GLOBE   © 2004 - 2012 FormHandler. All rights reserved.   -   Open source license