Lara
Lara

Reputation: 3021

Not able to POST form data

I have a Bootstrap form which contains Various fields which need to be entered by User.On Submission of this form I want it to send data to WebService.

But it is not sending user input data of the form.Here is the HTML Markup.

<form class="form-horizontal" role="form" action="~/RegisterUser" method="post">
    <div class="form-group">
        <label for="firstName" class="col-sm-3 control-label"> First Name </label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="FirstName" placeholder="FirstName" required />
        </div>
    </div>
</form>

and When I am seeing in chrome I am getting Request URL:http://localhost:54990/RegisterUser as Request URL. Is there anything I am missing on the form or input field creation.

My Service is correct and I am able to get the debugger breakpoint over there with no data that was posted from User.

Upvotes: 0

Views: 103

Answers (2)

nameless
nameless

Reputation: 1521

You always give all fields that should be accessed after posting a form a name-attribute. So do something like

<input type="text" class="form-control" id="FirstName" name="FirstName" placeholder="FirstName" required />`

then you can access it by using

$_POST['FirstName'] or however you want to access the values posted.

Upvotes: 4

Quentin
Quentin

Reputation: 943510

Your input doesn't have a name. Only named inputs can be successful.

Upvotes: 9

Related Questions