Gossamer Forum
Home : Products : DBMan : Discussions :

Form Submit Problem Inside *.pl

Quote Reply
Form Submit Problem Inside *.pl
I am trying to do something that I think should work but it doesn't seem to. I have added to the sub html_record_long section a form button to send the Address and Zip code to Mapblast so the user can get directions.

<TR><TD ALIGN="Left" VALIGN="CENTER"><$font_color>Driving Directions:</FONT></TD>
<TD><FORM name=mapbl method=get action="http://www.mapblast.com/mblast/map.mb" target="_blank">
<input type="hidden" name="AD2" value="$rec('Address')">
<input type="hidden" name="AD3" value="$rec('Zip')">
<INPUT type=hidden name="loc" value="us">
<INPUT type=hidden name="worldres" value=>
<INPUT type=hidden name="CMD" value="GEO">
<input type="submit" value="Map It!"></TD></TR>

The Submit or Map It! button appears in the form, is clickable and works however the data from $rec('Address') and $rec('Zip') is not being written in. When the MapBlast Page comes up it shows in the Street Address field as ('Address') and in the Zip Code Field ('Zip). Is what I am trying to do possible? In the above code I realize the form tag is not closed and in theory is shouldn't work but it does. The same thing happens whether it is closed or not. Actually with the form tag closed the button is offset top right inside the table.

Any help would be appriciated. It is probably something simple I am missing cause I have been working at this to long.

L. Bishop
Quote Reply
Re: [lab99] Form Submit Problem Inside *.pl In reply to
Change

$rec('fieldname') to $rec{'fieldname'}

see if that works...

also

Quote:
Actually with the form tag closed the button is offset top right inside the table.

That's the kind of stuff that'll drive you nuts! Try sticking it in it's own table row.
<tr><td></form></td></tr>
Quote Reply
Re: [lab99] Form Submit Problem Inside *.pl In reply to
Check out the following threads:

This is the one I use for links to directions:

Thead reference: 000633 Forum 12
Subject: Driving Direction link
spike - 3-Aug-99

Thread: http://gossamer-threads.com/p/000997
Topic: Conditional Statements in sub html_record
pabloa - posted May 13, 1999

Please note the URLs above may have changed, if so, please search by either Topic or username.

Note: You have to allow for spaces within the address fields. Don't forget to add in your db.cgi file:

sub urlencode {
# --------------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
return $toencode;
}

Basically, here is what I'm using for US addresses only. In html_record_long I have:

$rec{'Address1'} =~ s/<?.B>//g; # for map display
$rec{'City'} =~ s/<?.B>//g; # for map display
$rec{'State'} =~ s/<?.B>//g; # for map display


if (( $rec{'Address1'} && $rec{'City'} && $rec{'State'} ) ) {
$addr = &urlencode($rec{'Address1'});
$city =&urlencode("$rec{'City'}, $rec{'State'}");

if ($rec{'showmap'} eq "Yes") {
print qq|[ <A HREF="http://maps.yahoo.com/py/maps.py?addr=$addr&csz=$city" target="new">View Map</A> in new window ] |;
}
}
print qq|

You can add an image within the link rather than text.

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Form Submit Problem Inside *.pl In reply to
>>
$rec{'Address1'} =~ s/<?.B>//g; # for map display
$rec{'City'} =~ s/<?.B>//g; # for map display
$rec{'State'} =~ s/<?.B>//g; # for map display

<<

I think you have that the wrong way around Smile

<?.B> means you are making < optional and . will match anything (and no "i" means b will be ignored)

I think you should be using:

=~ s|</?b>||ig;

....that is of course if you are trying to remove bold tags....(thats what it seems like you are trying to do).

Last edited by:

Paul: Jun 28, 2002, 2:15 AM
Quote Reply
Re: [Watts] Form Submit Problem Inside *.pl In reply to
Thanks Watts, changing the ( to a { took care of the problem. I am running in 1024 mode and both symbols look almost the same unless I squint. Also I didn't insert </form> and for some strange reason it still works.

If anyone else wants to add this map link to dbman make sure you go into db.cgi line 548 and take the <B></B> out from around the end of the line $2. If you don't the bold tags are inserted in the data sent to mapquest. Doing this results in the search criteria no longer showing up bold when a search is done but to me at least it is not a problem.