This topic is locked

Which event to use to save field data on view page?

3/19/2009 6:18:08 PM
PHPRunner General questions
H
hlewis author

Hi,
Can anyone help? Which event would you use to save data on a view page. Also how would you incorporate a checkbox and pop up description field to save the view page fields.

Sergey Kornilov admin 3/19/2009

Not sure how you can save data on View page. Are you talking about the Edit page?

H
hlewis author 4/12/2009

Not sure how you can save data on View page. Are you talking about the Edit page?

H
hlewis author 4/12/2009





This is what I'm trying to achieve.
Within a members website, I want to set up a facility that allows members to save to a list of their favourite members. What I have in mind then, is the list page will show say member name, city and age. When you select the member from the list page it takes you to that member's 'view' page where you see more information about the member e.g name, city, age, gender, likes, dislikes,etc. The user should then be able to from the view page save the member to their list of favourites in a another table. I'm thinking this could be achieved with a 'Save as Favourite' button on the view page, with the supporting script underneath which makes sure the member is not already saved as a favourite. I need an example of any events to use and the script which would be able to perform this.
Regards

J
Jane 4/13/2009

Hi,
I see what you're saying.

Here are some tips:

  • add new button on the view page on the Visual Editor tab.

    Here is a sample code:
    <input type=button class=button value="Save as Favourite" onclick="tablename_view.php?editid1={$show_key1}&save={$show_key1}">


  • check $_REQUEST["save"] in the View page: Before process event and save record if needed.

H
hlewis author 4/14/2009

Thanks for that.
Will the code take all the variables from the View page? If yes, is there a way to just grab 2 or 3 of the field/values? As with the members example, I'd probably just need to save values from an id and possibly name field as opposed to values for all of the fields in a members profile.
Regards

J
Jane 4/15/2009

Hi,
you can select all values from table using this code:

global $dal;

$rs = $dal->TableName->Query("RecordID=".$_REQUEST["editid1"],"");

$data = db_fetch_array($rs);

//all values are in the $data array, I.e $data["Field1"]



where TableName is your actual table name, RecordID is your actual field name.