This topic is locked

Auto Populating a Field

9/4/2008 4:06:57 AM
PHPRunner General questions
L
L4Leaner author

I am new to PHP and PHPRunner and am trying to get my head around what is no doubt a simple task.
I have a table called "General" which lists vehicles and their attributes in which I have a field called "Description"
I created a link to a table called "Mail" on the View page which takes the viewer to the Add page of the table "Mail" to enable the visitor to enquire after the particular item in question
In the table "Mail" I have a field called "Subject"
Question: How do I autopopulate the field "Subject" on the "Mail" form with the content of the field "Description" as taken from the previously viewed table "General"
Hope this is clear <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=9423&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' />

J
Jane 9/4/2008

Hi,
here are some tips:

  1. pass ID of record in your link.

    Here is a sample:
    <a href="mail_add.php?id={$show_key1}">email</a>



2. check passed variable in the Add page: Before process event on the Events tab and select description value from General table.

Here is a sample:

global $conn;

if (@$_REQUEST["id"])

{

$str = "select Description from General where RecordID=".$_REQUEST["id"];

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

$_SESSION["Description"] = $data["Description"];

}



3. use $_SESSION["Description"] as default value for field Subject on the "Edit as" settingsdialog on the Visual Editortab.

L
L4Leaner author 9/4/2008

Jane..... thow art truly a goddess among women.
That worked like a dream... GOD BLESS YOU. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=32691&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />