This is a post to share the love …
I created a form in PHP using Twitter’s Bootstrap. I use Bootstrap because it’s so damn sexy and I seriously suck at design. The form was created to accept a dump from a table with possibly 1000’s of lines of delimited text (which was then inserted into a MySQL table).
To make it super fancy, I decided to use Powershell to call the CLI extract tool to do the dump and then someone suggested using Invoke-WebRequest to send it automatically.
After figuring out how to install Powershell v3 on my Windows 7 machine I embarked in attempting to send data via this fancy new cmdlet. Except … it wasn’t working! GAH! #rage #smash (hashtags are cool in blog posts, right? RIGHT!)
After a bit of screwing around I’ve discovered that Invoke-WebRequest didn’t pick up any of the forms fields. Considering I only had two, <button> and <textarea>, I was in serious “WTF” territory!
After some more trial and error and using my Google-fu, I started trialling different methods of creating forms from examples around the net. The one thing in common, they use .
And a solution was born. I had to use <input type=”text”> and <input type=”submit”>.
You know what really sucks? Pasting 1000 lines of text into a single row text box.
I ended up getting around it by setting it to hidden. That way, if you manually cut and paste, you see a nicely spaced <textarea> box but if you use Invoke-WebRequest, then it still works.
The final form looked like this: