CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
questions please help

 



Calvin
stranger

Jul 25, 2001, 9:56 PM

Post #1 of 2 (742 views)
questions please help Can't Post

1.

"
1|Calvin|<A HREF="mailto:calvin@puremadnezz.com">|<A HREF="http://www.puremadnezz.com/">||12345678|xcloud0|xcloud2000x@hotmail.com|xcloud2000x|||||Test|06-22-2001|00:47:45|216.130.72.133|c-72-133-res1.mts.net"

To call the entries:

open(DATA,"<$vars_gen{'CGIPath'}/variables/vars_entries.cgi") or die ("Unable to open guestbook entry file.");
@line = <DATA>;
close(DATA);
foreach $line (@line) {
chomp $line;
($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11,$var12,$var13,$var14,$var15,$var16,$var17,$var18) = split(/\|/,$line);

It converts the new line to table format and I've tried using that if statement to strip it out of there and it's not working.

Here is an image of what it looks like:

http://www.puremadnezz.com/gif.gif

2.

Okay...

I have a sub rountine edit which is called by "gb.cgi?action=edit?number="gbnumber"

The picture I posted about is the control panel for the guestbook entries. I use:

open(DATA,"<$vars_gen{'CGIPath'}/variables/vars_entries.cgi") or die ("Unable to open guestbook entry file.");
@line = <DATA>;
close(DATA);
foreach $line (@line) {
$line =~ s/\n//g;
($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11,$var12,$var13,$var14,$var15,$var16,$var17,$var18) = split(/\|/,$line);


As the for each for the edit guestbook entries.

Now, this for each looks for everyline on the database file and returns the variables ($var1-$var18).

The sub looks kind of like:


sub edit {

$Copyright = &Copyright;
$Menu = &Menu;
$CPHeader = &CPHeader;

open(DATA,"<$vars_gen{'CGIPath'}/variables/vars_entries.cgi") or die ("Unable to open guestbook entry file.");
@line = <DATA>;
close(DATA);
foreach $line (@line) {
$line =~ s/\n//g;
chomp $line;
($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11,$var12,$var13,$var14,$var15,$var16,$var17,$var18) = split(/\|/,$line);

print<<THIS;

<<--HTML-->>

THIS

}

}


So, it displays all entries and their forms in one giant page. Let's say I clicked on gb.cgi?action=edit&number=5 then it would still do the same thing. I want these to be individual pages.

I tried removing the for each statement, it kind of works but it doesn't display the variables ($var1-$var18)

How can I fix this??

After I changed it to:

open(DATA,"<$vars_gen{'CGIPath'}/variables/vars_entries.cgi") or die ("Unable to open guestbook entry file.");
@line = <DATA>;
close(DATA);
$number = 5; #the number of the entry to edit
$line = $line[$number];
chomp $line;
($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11,$var12,$var13,$var14,$var15,$var16,$var17,$var18) = split(/\|/,$line);


It kind of works again. It prints the fifth entry in each of the forms. How can I make it so it will print the entries in all forms?

I want it to read the entire file by the FIRST "|". Then I have the entry where you click and it goes to admin.cgi?action=edit&number=5. It will print ALL data in the fields. I want it to do that for EVERY entry. So if you lick on maybe admin.cgi?action=edit&number=1, it will print the first field. The code you made prints the fifth entry in all places (admin.cgi?action=edit&number=1-5) and I don't know how to fix it.



dsb
stranger

Jul 26, 2001, 8:37 AM

Post #2 of 2 (730 views)
Re: questions please help [In reply to] Can't Post

Not to be a formatting snob, Calvin, but your post is hard to read. You can edit and add stuff like 'pre' tags to distinguish code from the regular text, you can activate what are supposed to be links.

Check out this page Forum FAQ for info on how to do all this stuff.

dan Wink

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives