CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Add button retains value?

Print topic Send  topic

Author Message
wayne186

Posts: 30
Posted: 11/26/2004, 7:24 PM

Hi,

I am trying to create a form that has an add button at the end of the form which when clicked will submit the data in the form to the database and then forward you to the next page which is a readable version of the form I just submitted.

For example I have a form inside a page called adduser.cpp with two fields,

Users Name
Users Date of Birth

I complete the two fields in the form and then select the add button. This add button then sends me to a read only view of the form I just submitted called readuser.cpp. I can get this far and get the add button to send me to the readuser.cpp page but the problem I have is that I can not fugure out how to preserve the parameters in the url. When I select add it sends me to the page as desired http://localhost/readuser.php but what is missing is the rest of the url to send me to the correct record in the database. For example I can enter it manually into the url and the page pops right up ie I created a new user called cedar and then select the add button. It sends me to a page containing the first user in the database because it did not use the information I entered in the username for the url but if I altered the url to be:

http://localhost/readuser.php?s_user_name=cedar

then the record I want appears straight away.

Without sending me down a path of php coding hell can anybody tell me how to do this within the gui of CSS? Do I need to add something to the Add button like an event on the client on click section? I am not a php guru but I am beginning to find my way around css so any help would be appreciated.
View profile  Send private message
Damian Hupfeld
Posted: 11/27/2004, 3:46 AM

If this is not a busy site, or where security is of low priority you could
do something easy like on your readuser grid change the sort order to
reverse order and it will then show the most recently created user. This
however does also mean that anyone returning to this page or entering the
URL directly will also see the most recently created user.

Another way (and I havent done this) would be to do something like a
GetValue on an AfterInsert event, and pass that to the new page. I would
also set the readuser grid properties to Use Null in the Where statement so
that if NO parameter was passed (ie someone just types in the URL of the
page they dont see any results.

I hope this hasnt muddied the waters any further!

regards
Damian Hupfeld
http://www.itng.com.au/services.php
wayne186

Posts: 30
Posted: 11/27/2004, 8:55 AM

Damian.. the first suggestion works a treat (so simple when you know how :-)

I am interested in getting the second option working since this would be more secure. The site will not be a busy one but I need to take security into consideration because of the nature of the site. Can you tell me how I do a GetValue on an AfterInsert event, and pass that to the new pageand set the readuser grid properties to Use Null in the Where statement so that if NO parameter was passed (ie someone just types in the URL of the page they dont see any results?

I am using CCS version 2.3.2.24 in php (backend PHP, Mysql and Apache on a win2003 platform). I have 'messed' around with some of the events on the properties of the submit button but I can not figure out how to do this and the tutorials are not exactly easily understood. I have tried several options in Server - on click and before show and also on the client on load or on click (for example set focus on click on the client).

Thanks for the first suggestion.. I will use this for now and hopefully you or somebody else can help me figure out how to get it to forward the information in the url after clicking. Many thanks Damian
View profile  Send private message
peterr


Posts: 5971
Posted: 11/27/2004, 3:17 PM

You may need a little PHP coding (could be just one line of code) and the best example is probably the "Multi-Step User Registration" in CCS Example Pack. It is also online at http://examples.codecharge.com/ExamplePack/MultiStepReg...gistration1.php
Since you don't need to retrieve the last inserted key, possibly the code you need would look like this:
$Redirect = $Redirect . "?user_id=".CCGetFromPost("s_user_name","");
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
wayne186

Posts: 30
Posted: 11/28/2004, 7:42 AM

Peter - the code looks fairly straight forward.. can you tell me where I put it? Do I go onto the button properties and put the code into a particular section like the events on click.
View profile  Send private message
peterr


Posts: 5971
Posted: 11/28/2004, 1:23 PM

You would place the code in the same place as shown in the example I pointed out. It's best if you review it and learn from it, so that you save yourself the trouble of coming back to the forums.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.