0

I need to collect data from a url and form entry and insert information into a data extension.

My cloud page url is https://pub.info.example.com/unsub when my button is clicked with the following html:

 <form id="myForm" method="post" action="unsub test/HandleForm">
  <input type="text" placeholder="email address" name="email_address" id="email_address" align="center"/>

<p style="text-align:center">
  <input type="submit" value="unsubscribe" onclick="validate()">
</p>
 </form>

it should be sent to my handle page with the url https://pub.info.example.com/HandleForm and looks like:

%%[ 
 SET @ceid = RequestParameter("ceid")
 SET @brand = RequestParameter("brand")
 SET @email_address = RequestParameter("email_address")
 InsertData("test_unsub","email_address",@email_address,"ceid",@ceid,
 "brand",@brand)
]%%
%%=v(@ceid)=%%
<br />
%%=v(@brand)=%%

Iam using https://pub.info.example.com/unsubtest?ceid=123&brand=ok as a test url and when button is clicked it says "bad request" with https://pub.info.example.com/unsub%20test/HandleForm

1 Answer 1

0

It looks like from your 'bad request' url that you have a space inbetween 'unsub' and 'test'. E.g. the %20 is a URL encoded space - which is also shown in your action attribute on form.

action="unsub test/HandleForm" should instead be action="unsubtest/HandleForm"

Since your page does not have that space in it, it is sending your form to a non-existant page.

Also, your form does not collect nor add the brand and ceid to the form submit from what I can tell - you might want to add those in to pass it to handle page to insert into DE.

e.g. (on form page)

%%[ 

  set @ceid = RequestParameter("ceid")
  set @brand = RequestParameter("brand")
]%%

then in the form add:

<input type="hidden" name="ceid" value="%%=v(@ceid)=%%" />
<input type="hidden" name="brand" value="%%=v(@brand)=%%" />

This will pass those values to your Handler page to gather via your RequestParameter functions.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .