Is it possible, to fill in the fields, whitch are known by the programm, as emailadress, and when the user added a second or more record, the 'name', 'adres', 'city', 'telephone', 'emailadres', etc., fields from the older record so the user don't have to fill these fields again?
Apr 3, 1999, 5:23 AM
Veteran / Moderator (8669 posts)
Apr 3, 1999, 5:23 AM
Post #2 of 28
Views: 8659
Yes.
In html.pl -- sub html_add_form
before
&html_print_headers;
add
undef %in;
$in{'Userid'} = $db_userid; # change to the actual fieldname you use for user id
my ($status,@hits) = &query("view");
if ($status eq "ok") {
$rec{'fieldname'} = $hits[fieldnumber];
}
Adjust the line
$rec{'fieldname'} = $hits[fieldnumber];
to match the field names and field numbers you want to transfer. Repeat the line as many times as you need to to fill in the fields you need.
change
&html_record_form (&get_defaults)
to
&html_record_form (%rec)
------------------
JPD
In html.pl -- sub html_add_form
before
&html_print_headers;
add
Code:
%rec = &get_defaults; undef %in;
$in{'Userid'} = $db_userid; # change to the actual fieldname you use for user id
my ($status,@hits) = &query("view");
if ($status eq "ok") {
$rec{'fieldname'} = $hits[fieldnumber];
}
Adjust the line
$rec{'fieldname'} = $hits[fieldnumber];
to match the field names and field numbers you want to transfer. Repeat the line as many times as you need to to fill in the fields you need.
change
&html_record_form (&get_defaults)
to
&html_record_form (%rec)
------------------
JPD
Apr 3, 1999, 10:29 AM
User (473 posts)
Apr 3, 1999, 10:29 AM
Post #3 of 28
Views: 8664
I don't think this works correctly.
I have made an extra sub: html_remove_form.
I change the 'html_add_form(&get_defaults)', where you let me change &html_record_form(&get_defaults) in ...(%rec), I did that by "&html_remove_form(&get_defaults)' that stand under "&html_record_form(&get_defaults)', too, but I think, there is the bug.
When I add a record, the email works, the add_succes show up, but when I click on the link, there is a search-failure. When I check the DB, there is NO record added. When I block the added lines in the sub html_add_form and change the other rules in the original stste, the whole thing worked correct. Do you see the fault???
Oh yes, when I will add for the second time in one login session, the older values are not fill in in the new add screen.
[This message has been edited by mart (edited April 03, 1999).]
I have made an extra sub: html_remove_form.
I change the 'html_add_form(&get_defaults)', where you let me change &html_record_form(&get_defaults) in ...(%rec), I did that by "&html_remove_form(&get_defaults)' that stand under "&html_record_form(&get_defaults)', too, but I think, there is the bug.
When I add a record, the email works, the add_succes show up, but when I click on the link, there is a search-failure. When I check the DB, there is NO record added. When I block the added lines in the sub html_add_form and change the other rules in the original stste, the whole thing worked correct. Do you see the fault???
Oh yes, when I will add for the second time in one login session, the older values are not fill in in the new add screen.
[This message has been edited by mart (edited April 03, 1999).]
Apr 3, 1999, 11:54 AM
Veteran / Moderator (8669 posts)
Apr 3, 1999, 11:54 AM
Post #4 of 28
Views: 8674
I place the files in the dir: 'http://www.autorandstad.nl/ftp/pub/' as auth_pl.txt, db_cgi.txt, default_cfg.txt, default_count.txt, default_db.txt, default_log.txt, default_pass.txt, html_pl.txt, please let me know, how you come to the files, because I, as a anounymous login, it failes, and with my browser also.
Apr 3, 1999, 10:40 PM
User (473 posts)
Apr 3, 1999, 10:40 PM
Post #6 of 28
Views: 8596
I shall try, (my English...)
I made that subroutine, because, when a user adds a record, he must fill in the number of days, the record will stay in the DB,( autodelete) and also his name, city and telephone number. For the adding part this sub is called, right under 'html_record_form'. But when a user will search for a record, he don't need to know the number of days that the record will stay in the DB and also the name, city and number of that owner of the record is not important, so in the search sub, that 'html_remove_record' is not called.
I hope, that this is clear for you, otherwise I see it. Thank you.
I made that subroutine, because, when a user adds a record, he must fill in the number of days, the record will stay in the DB,( autodelete) and also his name, city and telephone number. For the adding part this sub is called, right under 'html_record_form'. But when a user will search for a record, he don't need to know the number of days that the record will stay in the DB and also the name, city and number of that owner of the record is not important, so in the search sub, that 'html_remove_record' is not called.
I hope, that this is clear for you, otherwise I see it. Thank you.
Apr 4, 1999, 6:27 AM
Veteran / Moderator (8669 posts)
Apr 4, 1999, 6:27 AM
Post #7 of 28
Views: 8606
I'll try to describe what I think you mean and you can tell me if it's correct, okay?
You have the html_record_form that has the fields a user can search on. And you have html_remove_form that has extra fields you need a user to fill out, but are not searchable. In your html_add_form you have (before you added the mod)
&html_record_form(&get_defaults);
&html_remove_form(&get_defaults);
The information you wish to copy from a previous record is contained in html_remove_form.
Is this correct?
If so, be certain that the first line of html_remove_form is
my (%rec) = @_;
I think that it might be a good idea for you to copy your html.pl file to an accessible directory on your website and rename it to html.txt. Then let me know where it is and I'll take a look at it.
------------------
JPD
You have the html_record_form that has the fields a user can search on. And you have html_remove_form that has extra fields you need a user to fill out, but are not searchable. In your html_add_form you have (before you added the mod)
&html_record_form(&get_defaults);
&html_remove_form(&get_defaults);
The information you wish to copy from a previous record is contained in html_remove_form.
Is this correct?
If so, be certain that the first line of html_remove_form is
my (%rec) = @_;
I think that it might be a good idea for you to copy your html.pl file to an accessible directory on your website and rename it to html.txt. Then let me know where it is and I'll take a look at it.
------------------
JPD
Apr 4, 1999, 8:26 AM
Veteran / Moderator (8669 posts)
Apr 4, 1999, 8:26 AM
Post #9 of 28
Views: 8625
Apr 4, 1999, 10:51 AM
Veteran / Moderator (8669 posts)
Apr 4, 1999, 10:51 AM
Post #10 of 28
Views: 8624
Apr 4, 1999, 11:10 AM
User (473 posts)
Apr 4, 1999, 11:10 AM
Post #11 of 28
Views: 8603
At this moment, I have a big problem: No one can acces my whole site, I've been experimented with the permissions, now I don't know how to put it back. Do you know???? I've mailed my webmaster, but I do not expect any answer before next tuesday, so that means, that my server is dead during one or two days. What do I have to do???
Apr 4, 1999, 5:18 PM
Veteran / Moderator (8669 posts)
Apr 4, 1999, 5:18 PM
Post #13 of 28
Views: 8619
I don't what to tell you about fixing your permissions. You may have to wait until your server admin gets back to you.
I did see your page at http://www.automart.nl/html_pl.txt
I saw a problem with your entering of the mod. (I'm sure you thought I'd made a typo, since I do make them a lot, but not this time.)
You have
$rec{'Date'} = $hits['2'];
$rec{'Email'}=$hits['16'];
$rec{'Verwijder'}=$hits['18'];
$rec{'Naam'}=$hits['20'];
$rec{'Woonplaats'}=$hits['21'];
$rec{'Telefoon'}=$hits['22'];
You need to have
$rec{'Date'} = $hits[2];
$rec{'Email'}=$hits[16];
$rec{'Verwijder'}=$hits[18];
$rec{'Naam'}=$hits[20];
$rec{'Woonplaats'}=$hits[21];
$rec{'Telefoon'}=$hits[22];
Also, in reading some of what you said earlier I saw
the original stste, the whole thing worked correct.
What "other rules" do you mean? The only thing I gave you here were lines to add to html_add_form. Possibly it's the "other rules" that are causing the problem.
------------------
JPD
I did see your page at http://www.automart.nl/html_pl.txt
I saw a problem with your entering of the mod. (I'm sure you thought I'd made a typo, since I do make them a lot, but not this time.)
You have
$rec{'Date'} = $hits['2'];
$rec{'Email'}=$hits['16'];
$rec{'Verwijder'}=$hits['18'];
$rec{'Naam'}=$hits['20'];
$rec{'Woonplaats'}=$hits['21'];
$rec{'Telefoon'}=$hits['22'];
You need to have
$rec{'Date'} = $hits[2];
$rec{'Email'}=$hits[16];
$rec{'Verwijder'}=$hits[18];
$rec{'Naam'}=$hits[20];
$rec{'Woonplaats'}=$hits[21];
$rec{'Telefoon'}=$hits[22];
Also, in reading some of what you said earlier I saw
Quote:
When I block the added lines in the sub html_add_form and change the other rules in the original stste, the whole thing worked correct.
What "other rules" do you mean? The only thing I gave you here were lines to add to html_add_form. Possibly it's the "other rules" that are causing the problem.
------------------
JPD
By 'othet rules' I meant the changes in the references to the sub's '&html_record_form'(&get_defaults)' to '&html_record_form(%rec)' and 'html_remove_form(&get_defaults)' to 'html_remove_form(%rec)', I think this won't have any problems. I try it, when the site is working so I'll put the result here. Thanks.
Mart Kruijt.
Mart Kruijt.
Apr 5, 1999, 6:51 AM
Veteran / Moderator (8669 posts)
Apr 5, 1999, 6:51 AM
Post #15 of 28
Views: 8575
Okay, we're going to have to do some debugging.
The changes I suggest you make are temporary, just so we can see what's going on.
After
<$font_title><b>
Voeg een nieuw record toe
</b></font></center><br>
add
$status<BR>
(This is still within the print qq| statement.)
Try adding a second record for a user. You should get the word "ok" printed on your screen, just below the title of the page. This will tell us if the &query statement is working correctly.
If you see "ok," add the following lines (still within the print qq| statement):
$rec{'Date'}<BR>
$rec{'Email'}<BR> $rec{'Verwijder'}<BR>
$rec{'Naam'}<BR>
$rec{'Woonplaats'}<BR>
$rec{'Telefoon'}<BR>
You should get the information for the user printed on your page.
Let me know what happens.
------------------
JPD
The changes I suggest you make are temporary, just so we can see what's going on.
After
<$font_title><b>
Voeg een nieuw record toe
</b></font></center><br>
add
$status<BR>
(This is still within the print qq| statement.)
Try adding a second record for a user. You should get the word "ok" printed on your screen, just below the title of the page. This will tell us if the &query statement is working correctly.
If you see "ok," add the following lines (still within the print qq| statement):
$rec{'Date'}<BR>
$rec{'Email'}<BR> $rec{'Verwijder'}<BR>
$rec{'Naam'}<BR>
$rec{'Woonplaats'}<BR>
$rec{'Telefoon'}<BR>
You should get the information for the user printed on your page.
Let me know what happens.
------------------
JPD
I've made the changes, now, in the beginning, it worked correct, but when the same user want to add his second record, he still must fillin his email, name, ...., and thats what this was all about, am I forgotten something? The html_pl.txt in my site is updated.
Thanks again.
Mart
Thanks again.
Mart
Apr 5, 1999, 10:58 AM
Veteran / Moderator (8669 posts)
Apr 5, 1999, 10:58 AM
Post #18 of 28
Views: 8644
Aha! It's not finding the previous record. Well, that tells me something, but I'm not sure what.
Let's make sure your search term is right. Instead of the printing out $status, substitute $db_userid.
Also, you might want to take out the line
undef %in;
although I don't think that will make a difference.
------------------
JPD
Let's make sure your search term is right. Instead of the printing out $status, substitute $db_userid.
Also, you might want to take out the line
undef %in;
although I don't think that will make a difference.
------------------
JPD
Apr 5, 1999, 1:52 PM
Veteran / Moderator (8669 posts)
Apr 5, 1999, 1:52 PM
Post #20 of 28
Views: 8586
I really don't understand this.
If the Userid is correct, then setting $in{'Userid'} and doing a query should end up giving you some results. (I didn't think that changing the "undef %in" would help, but I was grasping at anything I could think of.)
I went to your site to try it out, but I couldn't add a record. (It's a lot easier for me if I can actually see what's happening.)
I am completely stumped. I have used this same structure a number of times and it's always worked for me.
I welcome anyone else who has a suggestion!
------------------
JPD
If the Userid is correct, then setting $in{'Userid'} and doing a query should end up giving you some results. (I didn't think that changing the "undef %in" would help, but I was grasping at anything I could think of.)
I went to your site to try it out, but I couldn't add a record. (It's a lot easier for me if I can actually see what's happening.)
I am completely stumped. I have used this same structure a number of times and it's always worked for me.
I welcome anyone else who has a suggestion!
------------------
JPD
Apr 5, 1999, 9:23 PM
Veteran / Moderator (8669 posts)
Apr 5, 1999, 9:23 PM
Post #21 of 28
Views: 8589
Now I'm really confused.
$db_userid is not defined in your .cfg file at all. It may have a similar name to your "Userid" field, but it is not the same thing. $db_userid is a variable that is defined in the db.cgi script and is set to the current user name.
I see the change you made in html.pl
$in{'Userid'} = $db_Userid;
Change it back to
$in{'Userid'} = $db_userid;
My note to
# change to the actual fieldname you use for user id
refers to the $in{'Userid'} part of the line, not the $db_userid.
I see that the $status is now "no search terms specified." That will change when you fix the $db_userid.
I'm not sure what you mean here. (Probably a language problem.) I still cannot add a record to the database to try it out for myself. There is something wrong with the "Remove" field. I set the
"Hoelang moet uw auto in de Database blijven staan?" to "14" and I get an error message
Remove (Too long. Max length: 5)
There is no point in working on a new feature until this is fixed.
Here's what I would suggest. Delete everything in your current database. Set autogenerate to 1 in your .cfg file. Take out the line (temporarily) in html_add_form -- &html_remove_form (%rec);
Add some records. Let me know when you've done it and I'll add some, too. At least then we'll know that the database is correct.
Aha! I just looked again at your .cfg file. You have
Userid => [17,'alpha',
and
$auth_user_field =18;
You need to make these the same.
------------------
JPD
Quote:
The $db_userid is in my .cfg, defined by 'Userid' and not 'userid'.$db_userid is not defined in your .cfg file at all. It may have a similar name to your "Userid" field, but it is not the same thing. $db_userid is a variable that is defined in the db.cgi script and is set to the current user name.
I see the change you made in html.pl
$in{'Userid'} = $db_Userid;
Change it back to
$in{'Userid'} = $db_userid;
My note to
# change to the actual fieldname you use for user id
refers to the $in{'Userid'} part of the line, not the $db_userid.
I see that the $status is now "no search terms specified." That will change when you fix the $db_userid.
Quote:
The '$Date' and '$Remove' give a good result.I'm not sure what you mean here. (Probably a language problem.) I still cannot add a record to the database to try it out for myself. There is something wrong with the "Remove" field. I set the
"Hoelang moet uw auto in de Database blijven staan?" to "14" and I get an error message
Remove (Too long. Max length: 5)
There is no point in working on a new feature until this is fixed.
Here's what I would suggest. Delete everything in your current database. Set autogenerate to 1 in your .cfg file. Take out the line (temporarily) in html_add_form -- &html_remove_form (%rec);
Add some records. Let me know when you've done it and I'll add some, too. At least then we'll know that the database is correct.
Aha! I just looked again at your .cfg file. You have
Userid => [17,'alpha',
and
$auth_user_field =18;
You need to make these the same.
------------------
JPD
Apr 5, 1999, 10:59 PM
Veteran / Moderator (8669 posts)
Apr 5, 1999, 10:59 PM
Post #22 of 28
Views: 8611
I'm sure that was why I couldn't add a record to your database. It told me that "Verwijder" was too long (maximum of 5 characters), when I had left the default "14" in the field.
Did you define "$db_verwijder" somewhere? I didn't find it in any of your scripts. Or are you referring to "$rec{'Verwijder'}"?
There is a real problem with your database if you are getting the fields messed up. You might try starting over with a blank database to see if that will fix it up.
I also notice that on your home page it says there are 3 records in the database, but there are actually 4. I did a search for your first record (BMW) and it said there were no matching records. The source of the problem is not immediately obvious, but it seems there is something with that record. You might try just removing the first record and see what happens.
------------------
JPD
Did you define "$db_verwijder" somewhere? I didn't find it in any of your scripts. Or are you referring to "$rec{'Verwijder'}"?
There is a real problem with your database if you are getting the fields messed up. You might try starting over with a blank database to see if that will fix it up.
I also notice that on your home page it says there are 3 records in the database, but there are actually 4. I did a search for your first record (BMW) and it said there were no matching records. The source of the problem is not immediately obvious, but it seems there is something with that record. You might try just removing the first record and see what happens.
------------------
JPD
I think I found one bug: The $db_userid is in my .cfg, defined by 'Userid' and not 'userid'. So I change that, and now the '$status' give 'no matching records'. The '$Date' and '$Remove' give a good result. My html_pl.txt in the dir. of my site is updated. I hope, you can get any further with this, because I don't know, where to search...