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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I modify a variable value

Status
Not open for further replies.

bobflanagan

Technical User
Jun 28, 2003
2
US
I have a CGI script that creates a form and returns a value to the text variable "subject". It then sends an email using this varible. I would like to prefix the value of the variable with a phrase such as "support request". I can then filter that when it arrives in my in basket for followup.

The form is executed by the statement

<INPUT type=&quot;submit&quot; value=&quot;submit message&quot;></TD>

 
You could use a select box
<select name=&quot;purpose&quot;>
<option value=&quot;support request&quot;>Support</option>
<option value=&quot;social&quot;>Social</option>
<option value=&quot;urgent&quot;>Urgent</option>
<option value=&quot;Meeting Request&quot;>Meeting Request</option>
</select>

And in your cgi script look for the name=value pair &quot;purpose&quot;, and prepend that to the variable

HTH
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Paul, that's what I suspected. Question: How do I &quot;prepend&quot; a variable and a string, I know in some languages one would say subject =&quot;Support Request: &quot; & subject to add text to the front of the variable 'subject' but I suspect that syntax doesn't work in a cgi.

Bob
 
In Perl, the concatenation operator is a dot ([tt].[/tt]) so something like [tt]&quot;Support request&quot; . $variable[/tt] should work.

//Daniel
 
#Let me make this a little clearer

#This setup should be done already if the cgi module is being #used
use CGI;
$q = new CGI;

#Grab the subject field that is submitted;
#You need to check and see what the name of the subject field is #in the HTML;
#I am assuming it is called 'subject';

my $subject = $q->param('subject');

#prepend variable

$subject = 'Support Request ' . $subject;



haunter@battlestrata.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top