CodeMama Posted February 20, 2009 Author Share Posted February 20, 2009 Huh? I don't get that, WorkOrderNumber isn't even a problem, that field inserts fine, the two that don't are Location and WorkOrderName.... Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-766984 Share on other sites More sharing options...
CodeMama Posted February 20, 2009 Author Share Posted February 20, 2009 have you echoed out $loacation and $workordername to see what it returns ??? Hi again and yep, I can echo out those two fields, in fact I do in the form to show the user what they are working with, I just can't get those two fields to insert back into the db with the new order. Will make a post with the most current page code. Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-766990 Share on other sites More sharing options...
CodeMama Posted February 20, 2009 Author Share Posted February 20, 2009 ??? here is today's current version, luckily I have a meeting and won't be around to work on it much...you know it's bad when a meeting sounds great!!! [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-766993 Share on other sites More sharing options...
allworknoplay Posted February 20, 2009 Share Posted February 20, 2009 Hi Codemama, I am onto your issue. A couple things I found. 1) Your use of short tags is now deprecated so for the Location and WorkorderName, just do this: Near line 371: <tr> <td align="left" nowrap><div class="CaptionReq">Property:</div></td> <td align="left"><div><input type="text" name="Location" value="<? echo $qryLocation ?>"></div></td> </tr> Near line 381: <tr> <td align="left" nowrap><div class="CaptionReq">Work Order Name: </div></td> <td align="left"><div><br><input type="text" name="WorkOrderName" value="<? echo $qryWorkOrderName ?>" size="35 " /></div></td> </tr> Also, when you submit the form, I don't see anywhere, where you are grabbing the actual variables for insert. You need to have these POST variables near the top of your script. $insert_location = $_POST['Location']; $insert_workordername = $_POST['WorkOrderName']; Then use the 2 variables I created for you, in your SQL insert statements... Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-767086 Share on other sites More sharing options...
darkfreaks Posted February 20, 2009 Share Posted February 20, 2009 Also a little side note short tags <? ?> are deprecated in PHP6 they still work in PHP 4-5 make sure if your using 4-5 that short tags are allowed in php.ini also you need to show us how you are grabbing the post variables and define them ??? Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-767274 Share on other sites More sharing options...
allworknoplay Posted February 20, 2009 Share Posted February 20, 2009 Also a little side note short tags <? ?> are deprecated in PHP6 they still work in PHP 4-5 make sure if your using 4-5 that short tags are allowed in php.ini also you need to show us how you are grabbing the post variables and define them ??? Thanks for clarifying the PHP versions...she should go without the short-tags anyways just to make herself ready for PHP6.... We have her code, she supplied it above, I checked it out and I don't see the POST variables anywhere unless I am being blind!!!!!!!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-767278 Share on other sites More sharing options...
darkfreaks Posted February 20, 2009 Share Posted February 20, 2009 she could be calling her post and get variables on a global spectrum which is not safe or recommended. in which case she needs to redo her scripting to disallow globals. Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-767284 Share on other sites More sharing options...
iratik Posted February 20, 2009 Share Posted February 20, 2009 I've had to do what you are doing before. I have an app which manages shipping documents where you cannot delete any documents (because they are legal agreements and users must be prevented from altering or deleting them). You can only create a new one. To do this, I reuse my edit add new shipping document form. When I created my add new shipping document form - i built in validation, so that if a value cannot be accepted it returns the user back to the original page with all the information intact. <input name='company[code]' value='<?=$_GET["company"]["code"]?>'> and so on... The neat thing is, i can reuse that functionality for cloning a record as well. All I need to do is select all the fields for the record i want to duplicate into a hash. $results=$db->Query("SELECT * FROM bol WHERE id='#bolid'",array('#bolid'=>$_GET["id"])); $qsvars=array(); foreach ($results[0] as $key=>$val) { $qsvars[]="$key=".urlencode($val); } $qs="?".implode("&",$qsvars); After this, i have a query string containing all the information of an existing company. I can redirect the user to the "Add New document" form and pass along that query string, only the fields that exist on the form will grab values from the QS. The add new document doesn't take an ID column, so that is ignored... any other issues will be resolved when the add new document is submitted - by validation ... preserving the cloned record information. Btw... The above code is _way_ easier in rails (and would be just as easy in php if your application is designed in MVC with some persistence between the controller and view) ... the essential entirety of creating a clone record process in rails just involves adding a method that will look up a document, store its fields in a controller instance variable(which are available to the view).. then render the "new shipping document" form. ##url /bols/clonedoc/5 ##bols_controller def clonedoc @bol=BOL.find(params[:id]) render :action=>:new end ##bols/new (new.rhtml) <form action='<%=url_for :action=>'insert'%>' method='post'> ... <%=render :partial=>'form'%> ##bols/_form.rhtml <input name='bol[somefield]' value='<%=@bol.somefield%>'> ... </form> Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-767479 Share on other sites More sharing options...
CodeMama Posted February 22, 2009 Author Share Posted February 22, 2009 Hi everyone, tomorrow I will be back at it in the office fiddling with this form, Iratik thanks for the Rails info, your meaning PHP on Rails? Hadn't thought about that, I don't even like php as a dev language, I did do my first Ruby walk thru the other day and wow, that is something I would like a chance to work with and learn, it's so intuitive and things are what they seem to be...I like that! Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-768406 Share on other sites More sharing options...
darkfreaks Posted February 22, 2009 Share Posted February 22, 2009 you can try Ruby on trax and PHP on trax both OOP ruby based programs for calling OOP PHPO methods in your software. here is a plain example of using OOP class methods to write a database update/insert/delete script/. http://www.tonymarston.net/php-mysql/databaseobjects.html Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-768622 Share on other sites More sharing options...
CodeMama Posted February 23, 2009 Author Share Posted February 23, 2009 Do the isset statements have to be in order like everything else with php and mysql? I am missing those for the Location and WorkOrderName maybe that is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-769187 Share on other sites More sharing options...
CodeMama Posted February 23, 2009 Author Share Posted February 23, 2009 wow do I feel silly it was the isset part .... doh...thanks for all who looked and gave me pointers!! Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-769216 Share on other sites More sharing options...
darkfreaks Posted February 23, 2009 Share Posted February 23, 2009 dont laugh at me when i say duh im glad you figured it out though Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-769332 Share on other sites More sharing options...
CodeMama Posted February 23, 2009 Author Share Posted February 23, 2009 thanks darkfreak! I find that usually it's something I have been staring at for so long i can no longer see it and it's mostly something silly and blatant lol and I say DOH to myself so so SO much!! Quote Link to comment https://forums.phpfreaks.com/topic/145956-solved-copy-order-problems/page/2/#findComment-769342 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.