Reputation: 77
For some reason when I use the metod="post" action="DisplayForm.aspx" and runat="server" I can't get the data to be displayed on a different page(DisplayForm) the .cs file string is being displayed but without the data from the form. I use regular HTML textboxes and did not finish all the cs file code because it all based on the same thing but the HTML is finished. I don't want to use PHP or JS
form HTML
<form autocomplete="on" runat="server" method="post" action="DisplayForm.aspx" id="log">
<h1>התחבר</h1>
<p>
<label for="username" class="uname" data-icon="u">שם משתמש: </label>
<input name="signinName" required="required" type="text" placeholder="myusername " pattern="{3,}" maxlength="10" oninvalid="this.setCustomValidity('שם משתמש צריך להיות בין 3-10 תווים') " id="signinU" />
</p>
<p>
<label for="password" class="youpasswd" data-icon="p">סיסמה : </label>
<input name="password" required="required" type="password" placeholder="eg. X8df!90EO" pattern="{6,8}" maxlength="8" onivalied="this.setCustomValidity('סיסמה צריכה להיות בין 6-8 מספרים') " oninput="SetCustomValidity('')" id="signinP" />
</p>
<p class="keeplogin">
<label for="loginkeeping">השאר אותי מחובר</label>
<input type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" />
</p>
<% =st %>
<p class="login button">
<input type="submit" value="התחבר" />
</p>
<div class="change_link">
<p>
אין משתמש?
<a href="#toregister" class="to_register" id="join">הצטרף</a>
</p>
</div>
</form>
DisplayForm.aspx.cs
public partial class DisplayForm : System.Web.UI.Page
{
public string st = "";
protected void Page_Load(object sender, EventArgs e)
{
//Signin vars
string signUser = Request.Form["signinName"];
//signup vars
string loginUser = Request.Form["loginUsername"];
st += "<p style='postition:absolute;top:20%;z-index:999;'>שלום" + signUser + "</p>";
}
}
I don't have any code to send the data because as far as I know the method='post' does that. This code does work when I use it in the .cs file of the page where the form is placed so maybe I need to add sending code?.
In the DisplayForm page, there is nothing except the data from the form
Hope I was clear
Thank you in advanced
Upvotes: 0
Views: 167
Reputation: 3751
try
string signUser = Request.Form["signinName"];
instead
string signUser = Request.Form["signinU"];
The request.Form contains the name of the keys of the input rather the ID.
Upvotes: 1