RE: [PHP] How to $_POST from a grid
[snip] I'm doing my development in Dreamweaver though the code is basic. To get to the grid I'm passing over the userID . Then basic a select statement in the results grid with a while loop the returns all the records related to the userID. It's just odd - because in Dreamweaver I build the grid with one table row, place my echo fieldx in each cell, then create a repeat region around the row. The repeat region is the while loop. The behaviour though is different for whatever reason. Using a link with GET (paramter in the URL) it distinguishes each primaryID correctly. Yet with POST no. As Jason just posted, yes it has individual submit buttons, yet they solely return the last record. [snip] Hi Stuart Have you looked at the HTML generated by your PHP code? Using view source you'll see what values each of your 3 forms contains and therefore what will be submitted in the POST. My guess from one of your previous posts is that all 3 forms contain the same value in the (hidden) ID field. You were getting the value from a class but did not appear to be passing any kind of index to the class to determine which value to return. HTH Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to $_POST from a grid
--- Graham Cossey [EMAIL PROTECTED] wrote: Hi Stuart Have you looked at the HTML generated by your PHP code? Using view source you'll see what values each of your 3 forms contains and therefore what will be submitted in the POST. My guess from one of your previous posts is that all 3 forms contain the same value in the (hidden) ID field. You were getting the value from a class but did not appear to be passing any kind of index to the class to determine which value to return. HTH Graham Graham - hope your doing good! It is 4:25am here but just fixed the problem. Solution - I created my standard repeat region around all fields I want returned. Within the repeat region I put a form around the submit button and included the hidden element as well in the form. So each record returned has a seperate form around the button. It works! Records returned properly. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to $_POST from a grid
I have set up a record grid, where the user may see a list of their records. Repeat region, etc. There is a button next to each record the user may click to allow them to update the particular record. This all worked fine with $_GET where I did a link on the button to send the PrimaryID over. Now I'm attempting to use $_POST and not having the same success. I moved the grid into a form and have a submit button now for the update button. Since the grid only is echos of the recordset fields, how does it know the correct PrimaryID to send when I hit the submit button. I'm thinking this is perhaps my problem. Can anyone help please Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to $_POST from a grid
[snip] I have set up a record grid, where the user may see a list of their records. Repeat region, etc. There is a button next to each record the user may click to allow them to update the particular record. This all worked fine with $_GET where I did a link on the button to send the PrimaryID over. Now I'm attempting to use $_POST and not having the same success. I moved the grid into a form and have a submit button now for the update button. Since the grid only is echos of the recordset fields, how does it know the correct PrimaryID to send when I hit the submit button. I'm thinking this is perhaps my problem. [/snip] Yeah, that's it. Without a lick of code or a pointer to the grid on the web we would be hard pressed to offer solutions or advice. Arrays maybe? Hidden form fields? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to $_POST from a grid
On Thursday 25 November 2004 00:28, Stuart Felenstein wrote: Since the grid only is echos of the recordset fields, how does it know the correct PrimaryID to send when I hit the submit button. I'm thinking this is perhaps my problem. Hidden fields, or give the submit button a name that's based on the primaryID. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Every man takes the limits of his own field of vision for the limits of the world. -- Schopenhauer */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to $_POST from a grid
--- Jason Wong [EMAIL PROTECTED] wrote: Since the grid only is echos of the recordset fields, how does it know the correct PrimaryID to send when I hit the submit button. I'm thinking this is perhaps my problem. Hidden fields, or give the submit button a name that's based on the primaryID. Thank you. Close but not there yet. I placed the hidden field in the row with the repeat region on it. Named it the same as I did using the $_GET. Problem is it's only bringing up the last record returned. i.e. 5 records are on the grid. Which ever one I chose to update, the 5th record is the one coming up on the update form. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to $_POST from a grid
--- Jay Blanchard [EMAIL PROTECTED] wrote: Without a lick of code or a pointer to the grid on the web we would be hard pressed to offer solutions or advice. Arrays maybe? Hidden form fields? Jay, fine - I thought I could spare you the code but address what the problem might be. In the grid, I am posting via $_POST the PrimaryID via: input name=JID type=hidden id=JID value=?php echo $rsVJ-Fields('JID'); ? Then in the update form: if (isset($_POST['JID'])) { $PJID = $_POST['JID']; $query .= sprintf(SELECT * FROM vj_prm WHERE JID = $PJID I hope this is a better story ;) Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to $_POST from a grid
On November 24, 2004 11:28, Stuart Felenstein wrote: I have set up a record grid, where the user may see a list of their records. Repeat region, etc. There is a button next to each record the user may click to allow them to update the particular record. snip / Since the grid only is echos of the recordset fields, how does it know the correct PrimaryID to send when I hit the submit button. I'm thinking this is perhaps my problem. Would it be possible to see the code that generates the grid? Both the php and HTML. -- Regards, David Bevan We could learn a lot from crayons: some are sharp, some are pretty, some are dull, some have weird names, and all are different colorsbut they all exist very nicely in the same box. http://www.getanyideas.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to $_POST from a grid
Hy David, well here is my code... I use smarty templating system for parsing values, but should give you a very clear idea of what must to be done. == MODULES LISTING TEMPLATE == {include file=$controllerTemplates/head.tpl} table width=100% border=0 cellspacing=0 cellpadding=0 align=center id=administration_listing tr td class=administration_listing_head{#head_name#}/td td class=administration_listing_head{#head_path#}/td td class=administration_listing_head align=center{#head_level#}/td td class=administration_listing_head align=center{#head_order#}/td td class=administration_listing_head align=center{#head_visibility#}/td td class=administration_listing_head align=center{#head_type#}/td td class=administration_listing_head align=center{#head_status#}/td td class=administration_listing_head align=center width=75{#head_actions#}/td /tr {section name=m loop=$modules} tr form action={#Address#}{$controllerPath}/{$modulePath}/updatemodule method=post input type=hidden name=moduleId value={$modules[m].moduleId} td class=administration_listing_row_{if $smarty.section.m.iteration is odd}one{else}two{/if} nowrap{$modules[m].moduleName}/td td class=administration_listing_row_{if $smarty.section.m.iteration is odd}one{else}two{/if} nowrapa href={$serverPath}{$modules[m].moduleController}/ {$modules[m].modulePath} target=_blank{$serverPath}{$modules[m].moduleController}/ {$modules[m].modulePath}/a/td td class=administration_listing_row_{if $smarty.section.m.iteration is odd}one{else}two{/if} align=center nowrapselect name=moduleLevel size=1 onchange=this.form.submit(){html_options options=$levelrange selected=$modules[m].moduleLevel}/select/td td class=administration_listing_row_{if $smarty.section.m.iteration is odd}one{else}two{/if} align=center nowrapselect name=moduleOrder size=1 onchange=this.form.submit(){html_options options=$orderrange selected=$modules[m].moduleOrder}/select/td td class=administration_listing_row_{if $smarty.section.m.iteration is odd}one{else}two{/if} align=center nowrapselect name=moduleVisibility size=1 onchange=this.form.submit()option value=0 {if $modules[m].moduleVisibility eq 0}selected{/if}{$smarty.config.visibility_invisible}/optionoption value=1 {if $modules[m].moduleVisibility eq 1}selected{/if}{$smarty.config.visibility_visible}/option/select/ td td class=administration_listing_row_{if $smarty.section.m.iteration is odd}one{else}two{/if} align=center nowrapselect name=moduleType size=1 onchange=this.form.submit()option value=none {if $modules[m].moduleType eq 'none'}selected{/if}{$smarty.config.type_none}/optionoption value=alias {if $modules[m].moduleType eq 'alias'}selected{/if}{$smarty.config.type_alias}/optionoption value=default {if $modules[m].moduleType eq 'default'}selected{/if}{$smarty.config.type_default}/option/ select/td td class=administration_listing_row_{if $smarty.section.m.iteration is odd}one{else}two{/if} align=center nowrapselect name=moduleStatus size=1 onchange=this.form.submit()option value=0 {if $modules[m].moduleStatus eq 0}selected{/if}{$smarty.config.status_inactive}/optionoption value=1 {if $modules[m].moduleStatus eq 1}selected{/if}{$smarty.config.status_active}/option/select/td td class=administration_listing_row_{if $smarty.section.m.iteration is odd}one{else}two{/if} align=center nowrap width=75a href={#Address#}{$controllerPath}/{$modulePath}/editmodule/ {$modules[m].moduleId}img src={#MediaAddress#}{#bEdit#} alt={#aEdit#} border=0/aimg src={#MediaAddress#}{#tPixel#} border=0 height=10 width=10{if $smarty.session.userlevel = 9}a href={#Address#}{$controllerPath}/{$modulePath}/deletemodule/ {$modules[m].moduleId}img src={#MediaAddress#}{#bDelete#} alt={#aDelete#} border=0/a{/if}/td /form /tr {sectionelse} trtd class=administration_listing_row_one colspan=8 align=center nowrap{#message_no_modules#}/td/tr {/section} /table {include file=$controllerTemplates/foot.tpl} == If you are not using smarty, just think the {section} tag as foreach($modules as $module) { } our also a faster one for($i=0; $i $t; $i++) { } where $t = count($modules)-1;. Best Regards, Bruno B B Magalhães -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to $_POST from a grid
On November 24, 2004 16:35, Stuart Felenstein wrote: To get to the grid I'm passing over the userID . Then basic a select statement in the results grid with a while loop the returns all the records related to the userID. It's just odd - because in Dreamweaver I build the grid with one table row, place my echo fieldx in each cell, then create a repeat region around the row. The repeat region is the while loop. The behaviour though is different for whatever reason. Using a link with GET (paramter in the URL) it distinguishes each primaryID correctly. Yet with POST no. As Jason just posted, yes it has individual submit buttons, yet they solely return the last record. Are you using one form for the entire page? If you make each row into a form and have the action set to go to the same page for each form then you would only need to add a hidden type input with the primaryID for which you want to search. Pull the value out of the _POST array on the action page and you can build your select with the appropriate where clause. If you are using one form for the entire grid, you will need to add a checkbox or radio button group in order to have the primaryID values sent to the action page. HTH -- Regards, David Bevan We could learn a lot from crayons: some are sharp, some are pretty, some are dull, some have weird names, and all are different colorsbut they all exist very nicely in the same box. http://www.getanyideas.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to $_POST from a grid
--- David Bevan [EMAIL PROTECTED] wrote: Would it be possible to see the code that generates the grid? Both the php and HTML. -- I'm preferring not to post the code solely becasue I don't want to expose all my database fields here. Of course this may cost me the help I need. I'm doing my development in Dreamweaver though the code is basic. To get to the grid I'm passing over the userID . Then basic a select statement in the results grid with a while loop the returns all the records related to the userID. It's just odd - because in Dreamweaver I build the grid with one table row, place my echo fieldx in each cell, then create a repeat region around the row. The repeat region is the while loop. The behaviour though is different for whatever reason. Using a link with GET (paramter in the URL) it distinguishes each primaryID correctly. Yet with POST no. As Jason just posted, yes it has individual submit buttons, yet they solely return the last record. Oh well. Sorry for wasting everyone's time. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php