Gossamer Forum
Home : Products : DBMan : Customization :

plus sign dissapearing

Quote Reply
plus sign dissapearing
Problem
I had dbman working fine and then installed file upload mod by jpdeni, which worked fine also. Then I noticed the + sign no longer is able to be added in any text fields e.g. +$49 , but before I could.?
Other than the mod the only difference is auto generate forms is now OFF, as required by the mod. All other fields are lined up, just the plus character dissapears.
I added the following in htm,l.pl under "sub html_record"

$rec{'Misc2'} =~ s/+/\+/g;
Misc2 being the problem field.
Here's how it looked after the addition (bold) (is it in the right place?)

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.


my (%rec) = @_; # Load any defaults to put in the VALUE field.
$rec{$db_key} =~ s/<.?B>//g;
$rec{'Misc2'} =~ s/+/\+/g;
($db_auto_generate and print &build_html_record(%rec) and return);


Here's is the error I get with the sub routine added...

CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: /+/: ?+*{} follows nothing in regexp at /home/page-secure/www/cgi-bin/shop/thepondguy//html.pl line 209.
Compilation failed in require at /home/page-secure/www/cgi-bin/shop/thepondguy//farm.cfg line 51.
Compilation failed in require at db.cgi line 53.

So, am I anm idiot, or is there an answer.

~Rick
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
You'd need it the other way around, however it won't do anything as you are replacing a + with a +

$rec{'Misc2'} =~ s/\+/+/g;
Quote Reply
Re: [Paul] plus sign dissapearing In reply to
Hmm. That kept the script from crashing. Then I experimented by changing it to
$rec{'Misc2'} =~ s/\#/+/g;
and while that worked, it was still written in the database as "#" which wont work.
what is a subroutine to simply allow "+" to be written into a field in the database?

~Rick
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
>>
Then I experimented by changing it to
$rec{'Misc2'} =~ s/\#/+/g;
and while that worked, it was still written in the database as "#" which wont work.
<<

yeah because you are trying to match # not \# so you'd need:


$rec{'Misc2'} =~ s/#/+/g;
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
Thanks again

tried $rec{'Misc2'} =~ s/#/+/g;

that still writes as #

what is a subroutine to simply write + as + ?

Thanks again. Apologies as I am very experienced in html/graphics, not cgi.

~Rick
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
Problem might be that the + sign is used in URL encoding and is swapped out by the parse from sub.

Consequently if you try and swap it you may also be swapping the + signs used in encoding..

chmod
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
Try...

=~ s/\+/&#043;/g;
Quote Reply
Re: [Paul] plus sign dissapearing In reply to
Wont work, as all I need is it to stay as an actual "+" written in the database.

I did figure out that this all has to do with the File Upload mod by jpdeni. so it is a problem somewhere in the mod, which changed things both in db.cgi and html.pl. She...is not taking e-mails I hear.

This script is kicking my a@@Pirate
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
>>Wont work, as all I need is it to stay as an actual "+" written in the database. <<

If you are printing the record in a html page, using my suggestion should work fine. Why do you need it to be an actual + ?

Last edited by:

Paul: Mar 26, 2002, 5:45 AM
Quote Reply
Re: [Paul] plus sign dissapearing In reply to
I've integrated the whole thing with a shopping cart. DBman allows the customer to manage their store. The plus has to stay a plus in the database field because the cart works this way...

In the database field using DBman the customer writes to data.dat like so,
PriceField 1: $100.00
PriceField2: CHECKBOX^Cooling Fan, AMCF,115 volt +$89
The cart software converts CHECKBOX^...to an actual checkbox in the html, and the + adds 89.00 to the price of Pricefield1

Now, when the + sign is stripped from the data.dat file, a customer checks on the check box and the cost is $89 instead of $189.

I can provide the actual store URL privately, it's a client's live store, e-mail if you'd like at rick@pinnacle-club.com
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
Hi,

If you could send me your ftp details via pm I can see if I can come up with a solution if you wish.
Quote Reply
Re: [Paul] plus sign dissapearing In reply to
Well...easier said than done. I run an e-commerce business and there are over 200 clients once inside the server. no offense.

I have an idea. Since this problem only occured since I installed the File Upload mod, maybe you can take a look at just the mod and see what is in there that may have caussed this problem.
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
The only thing I can see is what chmod said:

$name =~ tr/+/ /;

...which is stripping out +'s ....seeing as the mod uses CGI.pm then that whole parse routine is unneeded anyway in theory.

Last edited by:

Paul: Mar 26, 2002, 6:43 AM
Quote Reply
Re: [Paul] plus sign dissapearing In reply to
crashing script now

CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: Invalid config file name: ~~db at db.cgi line 52
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
Here's some code that I use for my scripts, try that if you want:

Code:
sub parse_form {
#----------------------------------------------------------
# Returns a hash of posted name/value pairs.

my @params = ();
my %input = ();

# Loop through the input.
for ($query->param()) {
@params = $query->param($_);
@params > 1 ? (@{$input{$_}} = @params) : ($input{$_} = $query->param($_));
}

return %input;

}

Last edited by:

Paul: Mar 26, 2002, 6:43 AM
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
I just edited something, make sure you copy the changed version or you'll get an error.
Quote Reply
Re: [Paul] plus sign dissapearing In reply to
Ill try that and let you know. Right now my freakin servers are offline though, so I'm at a standstill.
POC Web Services - www.POC.us
Quote Reply
Re: [Paul] plus sign dissapearing In reply to
In Reply To:
Here's some code that I use for my scripts, try that if you want:

Code:
sub parse_form {
#----------------------------------------------------------
# Returns a hash of posted name/value pairs.

my @params = ();
my %input = ();

# Loop through the input.
for ($query->param()) {
@params = $query->param($_);
@params > 1 ? (@{$input{$_}} = @params) : ($input{$_} = $query->param($_));
}

return %input;

}
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
I think that did the trick

I notice one thing though.

In searching for records to modify, it will not locate a record by stock number, unless I have the catagory also correctly in the search routine.
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
Forget it...I fixed that. Your change made the search a little more sensitive, and a - line preceded the categories in the search and was searching for that. I eliminated the line and it works great now. Cant thank you enough as many clients were affected by this undiscovered bug. Is there any thing your change might affect that I should be aware of?

~Rick
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
>>Is there any thing your change might affect that I should be aware of? <<

Yes, it won't join multiple values using ~~ like the original parse routine does. That can be easily fixed though by changing:

@params > 1 ? (@{$input{$_}} = @params) : ($input{$_} = $query->param($_));

to something like:

@params > 1 ? (@{$input{$_}} = join ('~~', @params)) : ($input{$_} = $query->param($_));

Last edited by:

Paul: Mar 26, 2002, 8:51 AM
Quote Reply
Re: [Paul] plus sign dissapearing In reply to
At the risk of disclosing my lack of knowledge about cgi...
when does "join multiple values using ~~ " come into play?

~Rick
POC Web Services - www.POC.us
Quote Reply
Re: [lostboy] plus sign dissapearing In reply to
When using a multi-select or more than one field with the same name like with checkboxes.