Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing data to seperate lines("newbie)

Status
Not open for further replies.

craazycanuck

Technical User
Apr 28, 2001
7
CA
Sorry guys, I realize this is an easy question but, I can't get my data to print to seperate lines...can't figure out where I am going wrong

#!/usr/bin/perl
print "Content-type: text/html\n\n";
$forminfo = <STDIN>;
@key_value_pairs = split(/&/,$forminfo);
foreach $pair (@key_value_pairs){
($key,$value) = split(/=/,$pair);
$value =~ s/\+/ /g;
$value =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack(&quot;C&quot;, hex($1))/eg;
$FORM_DATA{$key} = $value;
}
print $FORM_DATA{'personname'},&quot;\n\n&quot;;
print $FORM_DATA{'address'}, &quot;\n\n&quot;;
print $FORM_DATA{'phone1'}, &quot;\n\n&quot;;
print $FORM_DATA{'phone2'}, &quot;\n\n&quot;;
print $FORM_DATA{'phone3'}, &quot;\n\n&quot;;
 
When a browser renders HTML it ignores things like newlines. What you need is some <BR> to tell the browser to start a new line.
Code:
print &quot;$FORM_DATA{'personname'}<BR>\n&quot;;
print &quot;$FORM_DATA{'address'}<BR>\n&quot;;
print &quot;$FORM_DATA{'phone1'}<BR>\n&quot;;
print &quot;$FORM_DATA{'phone2'}<BR>\n&quot;;
print &quot;$FORM_DATA{'phone3'}<BR>\n&quot;;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top