phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Problems making "submit" and sql update


 
Search this topic... | Search MOD Writing... | Search Box
Register or Login to Post    Index » MOD Writing  Previous TopicPrint TopicNext Topic
Author Message
guyb
Board Member



Joined: 30 Sep 2009

Posts: 11



PostPosted: Fri Oct 02, 2009 7:45 am 
Post subject: Problems making "submit" and sql update

Hi, I'm trying to populate an ACP form which can be edited and resubmitted to an sql table with both the existing and the newly edited values - but the data does not seem to be getting received and passed on.

The form was originally just a tabular display of auction listings and data (from the phpbb-auction.com mod), which I'm trying to turn into an interactive control panel:

a) I created a "mode" which is supposed to action the submit request
b) I added a "submit" button alongside each auction item listing so that specific item gets re-UPDATEd in the sql table

most of my modding code is based on existing snippets in phpbb2, but for some reason I can't get my sequences to work.


1. This is my "mode":

Code:
     if ( $mode == "admin_offer_edit" )
    {
    $total_offers = 0;
     while( $row = $db->sql_fetchrow($result) )
     {
         $offer_rowset[] = $row;
         $total_offers++;
     } // while
     $db->sql_freeresult($result);
     $offer_id = ( isset($HTTP_GET_VARS[POST_AUCTION_OFFER_URL]) ) ? $HTTP_GET_VARS[POST_AUCTION_OFFER_URL] : $HTTP_POST_VARS[POST_AUCTION_OFFER_URL];

     $auction_offer_title = ( isset($HTTP_POST_VARS['auction_offer_title']) ) ? $HTTP_POST_VARS['auction_offer_title'] : $offer_rowset[$i]['auction_offer_title'];
     $auction_offer_text = ( isset($HTTP_POST_VARS['auction_offer_text']) ) ? $HTTP_POST_VARS['auction_offer_text'] : $offer_rowset[$i]['auction_offer_text'];
     $auction_offer_admins_uncensored_text = ( isset($HTTP_POST_VARS['auction_offer_admins_uncensored_text']) ) ? $HTTP_POST_VARS['auction_offer_admins_uncensored_text'] : $offer_rowset[$i]['auction_offer_admins_uncensored_text'];
    $auction_offer_comment = ( isset($HTTP_POST_VARS['auction_offer_comment']) ) ? $HTTP_POST_VARS['auction_offer_comment'] : $offer_rowset[$i]['auction_offer_comment'];
    $auction_offer_price_start = ( isset($HTTP_POST_VARS['auction_offer_price_start']) ) ? $HTTP_POST_VARS['auction_offer_price_start'] : $offer_rowset[$i]['auction_offer_price_start'];
    $auction_offer_reserve_factor = ( isset($HTTP_POST_VARS['auction_offer_reserve_factor']) ) ? $HTTP_POST_VARS['auction_offer_reserve_factor'] : $offer_rowset[$i]['auction_offer_reserve_factor'];
    $auction_offer_direct_sell_price = ( isset($HTTP_POST_VARS['auction_offer_direct_sell_price']) ) ? $HTTP_POST_VARS['auction_offer_direct_sell_price'] : $offer_rowset[$i]['auction_offer_direct_sell_price'];
    $auction_offer_shipping_price = ( isset($HTTP_POST_VARS['auction_offer_shipping_price']) ) ? $HTTP_POST_VARS['auction_offer_shipping_price'] : $offer_rowset[$i]['auction_offer_shipping_price'];   
     $auction_offer_special = ( isset($HTTP_POST_VARS['offer_special']) ) ? ( ($HTTP_POST_VARS['offer_special']) ? TRUE : 0 ) : (( $offer_rowset[$i]['auction_offer_special']) ? "checked=\"checked\"" : "");   
     $auction_offer_on_top = ( isset($HTTP_POST_VARS['offer_on_top']) ) ? ( ($HTTP_POST_VARS['offer_on_top']) ? TRUE : 0) : (( $offer_rowset[$i]['auction_offer_on_top']) ? "checked=\"checked\"" : "");
     $auction_offer_bold = ( isset($HTTP_POST_VARS['offer_bold']) ) ? ( ($HTTP_POST_VARS['offer_bold']) ? TRUE : 0) : (( $offer_rowset[$i]['auction_offer_bold']) ? "checked=\"checked\"" : "");


2. This is the trigger which should call up the mode:
Code:
'S_ADMIN_OFFER_EDIT' => append_sid("admin_auction_offer.$phpEx?mode=admin_offer_edit&" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . ""),


3. These are relevant portions of my "form" code:
Code:

<form enctype="multipart/form-data" method="post" action="{S_ADMIN_OFFER_EDIT}">

and

    <tr>

        <td class="row2"><input type="hidden" name="offer_id" value="{offer.AUCTION_OFFER_ID}" /><a href="{offer.U_AUCTION_OFFER_VIEW}" target="_blank" class="gensmall">{offer.AUCTION_OFFER_ID}</a></td>
        <td class="row2" align="center"><textarea rows="2" cols="30" class="post" type="text" name="auction_offer_title" maxlength="255" size="255" />{offer.AUCTION_OFFER_TITLE}</textarea></td>
        <td class="row2" align="center"><input type="text" class="post" name="auction_offer_price_start" size="10" maxlength="10" value="{offer.AUCTION_OFFER_PRICE_START}" /></td>
        <td class="row2" align="center"><input type="text" class="post" name="auction_offer_reserve_factor" size="10" maxlength="10" value="{offer.AUCTION_OFFER_RESERVE_FACTOR}" /></td>
<!--        <td class="row2" align="center">{offer.AUCTION_OFFER_RESERVE_FACTOR}</td> -->
        <td class="row2" align="center"><input type="text" class="post" name="auction_offer_direct_sell_price" size="10" maxlength="10" value="{offer.AUCTION_OFFER_DIRECT_SELL_PRICE}" /></td>
        <td class="row2" align="center"><input type="text" class="post" name="auction_offer_shipping_price" size="10" maxlength="10" value="{offer.AUCTION_OFFER_SHIPPING_PRICE}" /></td>
        <td class="row2" align="center">{offer.AUCTION_OFFER_PAID}</td>
        <td class="row2"><a href="{offer.U_AUCTION_OFFER_MARK_PAID}" class="gensmall">{offer.L_AUCTION_OFFER_MARK_PAID}</a></td>
        <td class="row2" align="center">{offer.AUCTION_OFFER_OFFERER}</td>
        <td class="row2" align="center">{offer.AUCTION_OFFER_VIEWS}</td>
        <td class="row2" align="center">{offer.AUCTION_OFFER_PICTURE}</td>
        <td class="row2" align="center"><input type="checkbox" name="offer_special" value="1" {offer.AUCTION_OFFER_SPECIAL_CHECKED}/></td>
        <td class="row2" align="center"><input type="checkbox" name="offer_bold" value="1" {offer.AUCTION_OFFER_BOLD_CHECKED} /></td>
        <td class="row2" align="center"><input type="checkbox" name="offer_on_top" value="1" {offer.AUCTION_OFFER_ON_TOP_CHECKED} /></td>
        <td class="row2" align="center">{offer.AUCTION_OFFER_SELL_ON_FIRST}</td>
<!--        <td class="row2" align="center">{offer.AUCTION_OFFER_COMMENT}</td> -->
        <td class="row2">{offer.AUCTION_OFFER_TIME_END}</td>
        <td class="row2"><a href="{offer.U_AUCTION_OFFER_DELETE}" class="gensmall">{L_AUCTION_OFFER_DELETE}</a></td>
        <td class="row2" align="center"><textarea rows="2" cols="40" class="post" type="text" name="auction_offer_text" maxlength="255" size="255" />{offer.AUCTION_OFFER_TEXT}</textarea></td>
        <td class="row2" align="center"><textarea rows="2" cols="40" class="post" type="text" name="auction_offer_admins_uncensored_text" maxlength="200" size="200" />{offer.AUCTION_OFFER_ADMINS_UNCENSORED_TEXT}</textarea></td>
        <td class="row2" align="center"><textarea rows="2" cols="40" class="post" type="text" name="auction_offer_comment" maxlength="255" size="255" />{offer.AUCTION_OFFER_COMMENT}</textarea></td>
      <td class="row2"><input type="hidden" name="mode" value="admin_offer_edit" />
      <input type="hidden" name="offer_id" value="{offer.AUCTION_OFFER_ID}" />
<!--      <input type="submit" name="submit" value="{L_ADMIN_AUCTION_OFFER_FIELD_EDIT}" /></td>      -->
      <input type="submit" name="{offer.U_ADMIN_OFFER_EDIT}" value="{L_ADMIN_AUCTION_OFFER_FIELD_EDIT}" /></td>
     
    </tr>


4. And this is what I see with "show source":
Code:
    <tr>

        <td class="row2"><input type="hidden" name="offer_id" value="333" /><a href="../auction_offer_view.php?ao=333&amp;sid=edb2f62bf32402a7680d90459fd8748c" target="_blank" class="gensmall">333</a></td>
        <td class="row2" align="center"><textarea rows="2" cols="30" class="post" type="text" name="auction_offer_title" maxlength="255" size="255" />auction_offer_title</textarea></td>
        <td class="row2" align="center"><input type="text" class="post" name="auction_offer_price_start" size="10" maxlength="10" value="0.00" /></td>
        <td class="row2" align="center"><input type="text" class="post" name="auction_offer_reserve_factor" size="10" maxlength="10" value="0.00" /></td>
<!--        <td class="row2" align="center">0.00</td> -->
        <td class="row2" align="center"><input type="text" class="post" name="auction_offer_direct_sell_price" size="10" maxlength="10" value="0.00" /></td>
        <td class="row2" align="center"><input type="text" class="post" name="auction_offer_shipping_price" size="10" maxlength="10" value="0.00" /></td>
        <td class="row2" align="center">Not Paid</td>
        <td class="row2"><a href="admin_auction_offer.php?ao=333&mode=mark_paid&amp;sid=edb2f62bf32402a7680d90459fd8748c" class="gensmall">Mark PAID</a></td>
        <td class="row2" align="center">myname</td>
        <td class="row2" align="center">27</td>
        <td class="row2" align="center">X</td>
        <td class="row2" align="center"><input type="checkbox" name="offer_special" value="1" /></td>
        <td class="row2" align="center"><input type="checkbox" name="offer_bold" value="1"  /></td>
        <td class="row2" align="center"><input type="checkbox" name="offer_on_top" value="1"  /></td>
        <td class="row2" align="center"></td>
<!--        <td class="row2" align="center"></td> -->
        <td class="row2">03/05/2009 - 02:55:08</td>
        <td class="row2"><a href="admin_auction_offer.php?ao=333&mode=delete&amp;sid=edb2f62bf32402a7680d90459fd8748c" class="gensmall">Delete offer. No Undo!</a></td>
        <td class="row2" align="center"><textarea rows="2" cols="40" class="post" type="text" name="auction_offer_text" maxlength="255" size="255" />auction_offer_text</textarea></td>
        <td class="row2" align="center"><textarea rows="2" cols="40" class="post" type="text" name="auction_offer_admins_uncensored_text" maxlength="200" size="200" />auction_offer_admins_uncensored_text</textarea></td>
        <td class="row2" align="center"><textarea rows="2" cols="40" class="post" type="text" name="auction_offer_comment" maxlength="255" size="255" /></textarea></td>
      <td class="row2"><input type="hidden" name="mode" value="admin_offer_edit" />
      <input type="hidden" name="offer_id" value="333" />
<!--      <input type="submit" name="submit" value="Upload Edit" /></td>      -->
      <input type="submit" name="admin_auction_offer.php?mode=admin_offer_edit&ao=333&amp;sid=edb2f62bf32402a7680d90459fd8748c" value="Upload Edit" /></td>

    </tr>


The critical portions of the string to be passed are "?mode=admin_offer_edit&ao=333", which would trigger the mode and pass back "auction_offer" id number 333, so the correct listing gets updated.

Now, if you look at the last 4 lines of code in my form code, there is 1 line I commented out because written as it was it didn't appear to catch either the mode or the "ao=" reference, so in the 4th line I replaced "name=submit" with the pre-coded URL for the item and I can see that it does catch that "ao=" part - but on debugging that field appears blank:

Code:
Couldn't update Admin's account changes. Please try again.

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' auction_offer_price_start = 0.00,

UPDATE phpbb_auction_offer SET auction_offer_title = auction_offer_title, auction_offer_text = auction_offer_text, auction_offer_admins_uncensored_text = auction_offer_admins_uncensored_text, auction_offer_comment = , auction_offer_price_start = 0.00, auction_offer_reserve_factor = 0.00, auction_offer_direct_sell_price = 0.00, auction_offer_shipping_price = 0.00, auction_offer_special = 1, auction_offer_on_top = , auction_offer_bold = WHERE PK_auction_offer_id = ''

Line : 457
File : admin_auction_offer.php


In the 3rd and 4th lines of code from the bottom (in my form code) I'm even passing the mode and offer id numbers as a hidden type in separate input commands, above the "submit" code, but it doesn't make a difference.

In the attached screenshot, when I mouseover the "upload" button you see that the URL displayed lacks the mode and "ao=" segment as well. As a result, despite what "view source" reveals, it may be that my "mode" isn't being executed at all, hence no form fields are being updated. Much of my form coding is even based on what I see on other phpbb form pages (like profile.php)... any ideas what I'm doing wrong?



auction-mod-acp.JPG
 Description:
 Filesize:  91.09 KB
 Viewed:  861 Time(s)

auction-mod-acp.JPG


Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Writing  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0306 seconds using 17 queries. (SQL 0.0020 Parse 0.0023 Other 0.0263)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo