Pass multiple arguments from an HTML form using POST to REST API

Hi,

(This might end up being more of an HTML question since I’m not an expert in web stuff, but here goes…)

I followed the REST API example for LEDs in the docs and I was able blink LEDs from an HTML form. Looking at the code, it seems that only a single value is passed through “args”: “on” or “off”. I’d now like to pass multiple arguments.

I modified the code to have 2 radio buttons (“left” and “right”), a text field (“steps”), and a submit button as follows:

<!DOCTYPE html>
<html>
<body>

<center>
<form action="https://api.particle.io/v1/devices/abc/turn?access_token=xyz" method="POST">
<fieldset>
<legend>Motor Calibration</legend>
<br>
<input type="radio" name="direction" value="left">Turn left
<br>
<input type="radio" name="direction" value="right">Turn right
<br>
Number of steps:<br>
<input type="text" name="steps">
<br>
<input type="submit" value="Do it!">
</fieldset>
</form>
</center>

</body>
</html>

On the Photon I put a serial print in turn() that simply prints out the String argument. I’m listening to it over serial on a host machine.

What I observe is that only the first argument, “left”/“right” or “steps”, is passed to turn(), but not both. For example: if I check “Turn left” and hit submit, turn() gets “left”. If I enter “123” in the text box and hit submit, turn() gets “123”. But if I do both and then hit submit, turn() gets only “left”.

Is there a way to pass both arguments at once, or do I have to concatenate them into a string on the HTML page? If I need to do the latter, can someone please point me to a tutorial/example ?

Thanks!