Setting and Displaying Page VariablesIntroductionVariables are containers for information such as text, HTML and MGI tags. Variables allow you to "hold" information until you need to display it further down the page or on another page of the site. The information in page variables is available from the point at which they are set until they are overwriiten or until the end of the page that is currently processing, whichever occurs first. The information in site variables is stored in a database and is available from the point at which they are set until they are overwritten by a new value or deleted. More often than not, the value of a variable is embedded in the parameter of another MGI tag. Read more about embedding. In this example, a page variable is used to concatenate and hold the subject of a confirmation email from a customer's form submission. The subject is then embedded in the confirmation mgiSendMail tag. MGI TagsSteps
Step 1: Create an information request form.
<FORM action="infoprocess.mgi" method="post"> <H2><CENTER>Information Request</CENTER></H2> <P><CENTER> Please complete all information below. </CENTER></P> <H2><CENTER> <TABLE BORDER="1" CELLSPACING="1" CELLPADDING="3"> <TR> <TD ALIGN="RIGHT">Name:</TD> <TD> <INPUT NAME="Name" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Address:</TD> <TD> <INPUT NAME="Address" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Phone:</TD> <TD> <INPUT NAME="Phone" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Email:</TD> <TD> <INPUT NAME="Email" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Questions/Comments:</TD> <TD> <TEXTAREA NAME="Comments" ROWS="7" COLS="27"> </TEXTAREA></TD> </TR> <TR> <TD> </TD> <TD><P><CENTER> <INPUT TYPE="submit" VALUE="Submit Request"> </CENTER></TD> </TR> </TABLE> </CENTER></H2> </FORM> Step 2: Create a send mail page for the information request and open it in a text editor.
Step 3: Insert the mgiSet tag, mgiPostArgument tag, and mgiSendMail tags.
<H2><CENTER>Information Request Submission</CENTER></H2> <P><CENTER>Thank you, your information request has been sent.</CENTER></P> <mgiSet name="ConfirmationSubject"> <mgiPostArgument name="Name"> Receipt Confirmation </mgiSet> <mgiSendMail to={mgiPostArgument name="Email"} from="info@domain.com" mailserver="mail.domain.com" subject={mgiGet name="ConfirmationSubject"}> Thank you <mgiPostArgument name="Name">. We have received your request for additional information. A representative will respond by phone or email within 48 hours. Please visit our site again. </mgiSendMail> <mgiSendMail to="info@domain.com" from="info@domain.com" mailserver="mail.domain.com" subject="Info Request"> Information Request ******************* Name: <mgiPostArgument name="Name"> Address: <mgiPostArgument name="Address"> Phone: <mgiPostArgument name="Phone"> Email: <mgiPostArgument name="Email"> Comments: <mgiPostArgument name="Comments"> </mgiSendMail> Step 4: Save the send mail page.
Step 5: FTP the information request form and send mail page to a web server running MGI.
Step 6: View the form in a web broswer and complete the information request.
Thank you Valerie Crisp. We have received your request for additional information. A representative will respond by phone or email within 48 hours. Please visit our site again.
Information Request ******************* Name: Andrew Carey Address: 125 Main St New York NY 20001 Phone: 256-458-9654 Email: acarey@aol.com Comments: I am interested in product 233445. What sizes are in stock? |