0

I have created the two Microsite page one for form and another for amp script to handle form

when i am clicking the form url link, it is redirected to Microsite page - In that page

first Name and last name will be there, after entering the values of first name and last name it will store the values in data extension using Amp script code

Form Code:

<form id="myForm",action="http://pages.S7.exacttarget.com/page.aspx?QS=5c591a8916642e734d7a5c1b6711737fd49578f31ab726a8f3a1a79db9cf2c2b" method="post">
<div>
<label for="firstname">First Name:</label>
<input type="text" id="firstname" name="user_firstname">
</div>
<div>
<label for="lastname">Last Name</label>
<input type="text" id="lastname" name="user_lastname">
</div>
<input type="submit" />

</form>

Amp script Code:

%%[ 
set @FstName = RequestParameter("firstname")
set @lastname = RequestParameter("lastname") 
InsertData("testforform","firstname",@FstName,"lastname",@lastname)
]%% 
%%=v(@firstname)=%%
%%=v(@lastname)=%%

Now i want to add picklist field using form and i have to store the piclist value in text using data extension,guide some form code and amp script code

Picklist Values:

  1. B.tech
  2. M.tech
  3. MCA
  4. MBA
0

It's pretty similar what you have did for textbox. you just call the drop down list name property in RequestParameter AmpScript function.

Form Code:

<!DOCTYPE html>
<html>
<body>
<form id="myForm",action="http://pages.S7.exacttarget.com/page.aspx?QS=5c591a8916642e734d7a5c1b6711737fd49578f31ab726a8f3a1a79db9cf2c2b" method="post">
<div>
<label for="firstname">First Name:</label>
<input type="text" id="firstname" name="user_firstname">
</div>
<div>
<label for="lastname">Last Name</label>
<input type="text" id="lastname" name="user_lastname">
</div>
<div>
<label for="cource">cource</label>
<select id="cource" name="cource">
  <option value="B.tech">B.tech</option>
  <option value="M.tech">M.tech</option>
  <option value="MCA">MCA</option>
  <option value="MBA">MBA</option>
</select>
</div>
<input type="submit" />

</form>
</body>
</html>

AmpScript Code:

%%[ 
set @FstName = RequestParameter("firstname")
set @lastname = RequestParameter("lastname") 
set @cource = RequestParameter("cource")
InsertData("testforform","firstname",@FstName,"lastname",@lastname)
]%% 
%%=v(@firstname)=%%
%%=v(@lastname)=%%
%%=v(@cource)=%%
0

If I understood correctly, you want to fetch the picklist value from form to ampscript and then from DE fetch the value and update the picklist on the landing page.

To add the picklist value in Ampscript code use RequestParameter with select attribute name and use insertdata function.

InsertData("testforform","firstname",@FstName,"lastname",@lastname,"Course", RequestParameter("course"))
  • ,In form code what i have to give display the picklist and after that if i click submit button , it have to capture the picklist value in amp script code and to store in the data extension – Learning user May 29 '17 at 9:07
  • I have updated the code, this will solve your question – Abhishek May 30 '17 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.