This topic is locked

Add an Edit Button to the View Page

12/3/2009 1:29:08 PM
PHPRunner Tips and Tricks
S
Sekaidragon author

Want to have a button on the View Page to Edit the Record you're looking at? Try this:

  1. Save your document in case you need to roll back.
  2. Go to the Visual Editor Tab for the View Page, put your cursor where you want the button to appear.
  3. Insert a new PHP Code Snippet and name it "edit_button".
  4. Paste the following code:



global $strTableName;

$button_name=" Edit Record "; //Change this to whatever you want the button text to say...
echo ("<SPAN class=buttonborder><INPUT class=button type=reset value=\"".$button_name."\"

onclick=\"window.location.href='".$strTableName."_edit.php?editid1=".$_REQUEST["editid1"]."'\"></SPAN>");
  1. Upload and Enjoy!

A
amarhoun 12/15/2009

Hi There,
Is it possible to have the same for ASP. If so what is the code in this scenario.
Thanks & Appreicate it.
A Marhoun

C
choanhemnhe 3/27/2011

Wow! I'm looking for this function!

many thanks!!!!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=57276&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />

501364 5/3/2012

Thank you! That was so easy!

Patti

milsimcorps 5/7/2012

First of all I would like to thank you for showing us this trick. This is an awesome tip.
I have added this button according to the the instructions to every view of all of my "Tables" including the "Custom Views" and it works perfect with the exception of the following "Custom View Table" called: _Paintball_Parks_
When the "Edit" button is clicked redirects to a strange address: http://www.milsimleague.info/leaguedatabase2/PaintballParks_edit.php?editid1=50.
the correct address should read: http://www.milsimleague.info/leaguedatabase2/Paintball[color="#FF0000"]_Parks_edit.php?editid1=50.
As you can see the button is not able to read the underscore. What am I doing wrong?
To view the actual page go to: http://www.milsimleague.info/leaguedatabase2/Paintball_Parks_view.php?editid=50

To view a working one visit: http://www.milsimleague.info/leaguedatabase2/Teams_view.php?editid=1001
Thank you in advance for your assistance and quick response.

S
stiven 5/9/2012

Thanks for this tip, its great!!
is it possible to have this but when you have edit in pop up enable so to edit the record on a pop up?

S
simonedan 2/1/2013

Hi, can be this used to Add a "Book" Botton, which will add(instead edit)the same record a a booking form.Suppose there is need to on other custom vew named booking where to add the new record as a booking.If not can somebody help to make this functioning? Ready for additional explanations

C
chuckbower 2/7/2013

Thank you very much for this tip. I might be able to use this in a project I am working on!!!
Chuck