I've been playing with this, off and on, but now I'm really trying to make this work.
I can't seem to get the record to pass to the found records.
Actually, I'm not sure it's really finding the record to pass.
What I did, was set it up so that the modify form has two 'forms' on it. The top one is search for URL and is called "GET_URL".
If that's not empty, or equal to "http://" then it tries to find the URL in the database. If it does, it reprints the modify form with the fields filled in, and if it doesn't, it passes it to the add form with the URL filled. in.
But it's not working.
I've gone through all the code frags that should work -- search.cgi and the admin modify routines, but can't figure out what isn't going on. Taking your code:
The idea is:
Connect to the database:
$db = new Links:: DBSQL "$LINKS{admin_root_path}/defs/Links.def";
Look for the URL and assign it to $recs (forcing an array??)
$recs = $db->query ( { URL => $url, ww => 1 });
Then, if any hits were found:
if ($db->hits) {
Code:
I gather this is attempting to take the first record found.
$rec = $recs->[0];
Then, take that record and convert it to hash format.
$rec = $db->array_to_hash ($rec);
then take that hash, and passit to the modify template.
&site_html_modify_form ( $rec );
}
else {
if the URL wasn't found, pass it to ADD
&site_html_add_form ( { URL => $rec->{'URL'} });
}
I just can't get it to work. I've tried changing the variable types, and such, but there seems to be one step missing, and I can't find it.
I'm lead to believe this since when I try to pass it, the blank template is printed, but it has an "error Unknown Tag Category" .
[This message has been edited by pugdog (edited September 16, 1999).]