Jump to content

Recommended Posts

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.

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...

 

 

 

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 ???

 

 

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!!!!!!!!!!!!

 

 

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>

 

 

 

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!

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.