[ic] Updating tables via form

Joachim Leidinger jojo@blackpoint.de
Sun, 06 May 2001 21:25:11 +0200


jimtoro@hoflink.com wrote:
> 
>  I am using MV4.04a and I am trying to do a update of a database as per
>  the "Updating Minivend database tables with a form" from the manual.
> 
> In the first page, I have the user enter the CODE for the item in question
> with:
> 
> ------------------------
> <form method=post action="[process]">
> <input type=hidden name="mv_doit" value="return">
> <input type=hidden name="mv_nextpage" value="update_bookdata">
> Booking Code Number <input type=text size=9 name="update_code" value="[value update_code]">
> <input type=submit name="mv_submit" value="Edit Booked Date">
> </form>
> ------------------------
> 
> Which seems to take the data fine, then it calls a page which includes the following
> code:
> 
> ----------------------------
> [set mv_data_enable]1[/set]
> [tag flag write]bookeddates[/tag]
> <form method=post action="[process-target]">
> <input type=hidden name="mv_data_table" value="bookeddates">
> <input type=hidden name="mv_data_key" value="code">
> <input type=hidden name="mv_data_function" value="update">
> <input type=hidden name="mv_nextpage" value="updated">
> <input type=hidden name="mv_data_fields"
>       value="code,dbstartdate,dbbookdate,dbbookoccasion,dbbookrfirstname,dbbookrlastname,dbbookaddr1,dbbookaddr2,dbbookaddr3,dbbookrtown,dbbookrstate,dbbookrzipcode,dbbookcardonly,dbbookvendor,dbbookvenphone,dbbookitemno,dbbookitemdesc,dbbookmaxprice,dbbookuser,dbbookcardno,dbbookdesc,dbbookcardprice,dbbookcardwrite,dbbookcallme,dbbookgiftwrap,dbbcancelcode">
> <pre>
> [loop arg="[value update_code]"]
> Booking ID Code:  [loop-code]
> Booking Created on  <input type=text name="dbstartdate" size=20 value="[loop-field dbstartdate]">
> Booked Date <input type=text name="dbbookdate" size=20 value="[loop-field dbbookdate]">
>   ---(note- deleted all other fields just to save space in this message)---
> [/loop]
> </pre>
> <input type=hidden name="mv_todo" value="set">
> <input type=submit value="Update Booking">
> </form>
> ------------------------------
> 
>  The problem is when the I use the above to edit a record it shows the
>  CODE for the item and then all the other fields show the text to the left
>  of the <INPUT> statements but empty values from the database in each box.
>  If I look at the source of the page in the browser the values for each of
>  the input lines comes up as 'value=""' instead of the fields data.  If I
>  edit any field and hit submit it will then update the data in the
>  database as normal. I verify this by going to minimate and using
>  the database edit function to view the record. The new data shows up in
>  the field for that record.
> 
>  How come I dont see the data for any of the fields when trying to update
>  them via the above code but if I update a field it does the update in the
>  database and keeps all other fields with their original information?.

Any message from the both error.log files?
Hmmm...it seems to me, the data or the text is not in the products
table. It seems to me, all that stuff is in another table "bookeddates".

Try

[loop arg="fi/bookeddates/se=[value update_code]"]

(mv_search_file       fi  S   Sets the file(s) to be searched)

or

Booking Created on  <input type=text name="dbstartdate" size=20
value="[data table="bookeddates" column="dbstartdate"
key="[loop-code]"]">

instead of

Booking Created on  <input type=text name="dbstartdate" size=20
value="[loop-field dbstartdate]">

(not tested)

Joachim

-- 
-------------<BPA FreeBsd>----------------------------------------------
Hans-Joachim Leidinger          black point arts Internet Solutions GmbH
email: jojo@blackpoint.de       FAX  : +49 0209-398265
http://www.bpaserver.net