This is my code:
<form action="mailto:helpdesk#work.com?subject=Websense Block Page" method="post" enctype="text/plain>
User Name: $*WS_USERNAME*$<br>
<input type="text" name="name" value ="$*WS_USERNAME*$"><br>
<STRONG>Workstation:</STRONG><br>
<input type="text" name="WORKSTATION"value ="$*WS_WORKSTATION*$"><br>
<STRONG>Current Date:</STRONG><br>
<input type="text" name="DATE" value ="$*WS_DATE*$"><br>
<STRONG>Category:</STRONG><br>
<input type="text" name="CATAGORY" value ="$*WS_CATEGORY*$"><br>
<STRONG>Requested URL:</STRONG><br>
<input type="text" name="RequestedURL" value ="$*WS_URL*$"><br>
<STRONG>Comment:</STRONG><br>
<input type="text" name="COMMENT" size="50"><br><br>
<STRONG>Status</STRONG>: Is this an Emergency?
<input type="radio" name="emergency" value="YES">Yes
<input type="radio" name="emergency" value="no">No
<br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
The output of this puts all of the information in a single line in the body of the email. Is there a way to put each field in a new row in the email?
Related
MVC beginner here. I got stuck on this issue. I have such view:
<form method="post" action="#Url.Action("UserAddRequested", "UsersController")" >
First name:<br>
<input type="text" name="firstname" value="">
<br>
Last name:<br>
<input type="text" name="lastname" value="">
<br>
Age:<br>
<input type="text" name="age" value="">
<br>
Email:<br>
<input type="text" name="email" value="">
<br>
<br>
<input type="button" value="Create" />
</form>
Hopefully you understand intention when user clicks create I want to call an action UserAddRequested in controller.
This is controller code
[HttpPost]
public ActionResult UserAddRequested()
{
return Content("Hi");
}
But when user clicks create button, nothing is displayed :(( Can someone help?
Add type="submit" to your button and No need to add UsersController just rename that to Users
<form method="post" action="#Url.Action("UserAddRequested", "Users")" >
First name:<br>
<input type="text" name="firstname" value="">
<br>
Last name:<br>
<input type="text" name="lastname" value="">
<br>
Age:<br>
<input type="text" name="age" value="">
<br>
Email:<br>
<input type="text" name="email" value="">
<br>
<br>
<input type="button" value="Create" />
</form>
you aren't submitting anything in your view. Instead you are using a plain HTML button. You need to change the type of that button to type="submit". There shouldn't be any difference in HTML/CSS between type = "button" and type = "submit"
<input type="submit" value="Create" />
This is driving me crazy. I know its something to do with the label tag. here is my code:
<form method="post" action="includes/loginprocess.php">
<label for="username">Username: </label>
<input type="text" name="username" value=''/>
<label for="password">Password: </label>
<input type="password" name="password" />
<input type="submit" name="submit" value="submit" />
</form>
The for and name are both the same?
The error is "The for attribute of the label element must refer to a form control."
According to http://www.w3schools.com/tags/att_label_for.asp, the value of for attribute of a label should be the id of the element the label is bound to, so add id attribute to the textboxes
<form method="post" action="includes/loginprocess.php">
<label for="username">Username: </label>
<input type="text" name="username" id="username" value=''/>
<label for="password">Password: </label>
<input type="password" name="password" id="password" />
<input type="submit" name="submit" value="submit" />
</form>
I have a form that I want to submit to paypal. When I submit the form I don't get to the overview for the submitted product but I end up on the default page for paypal.
I started with http://sandbox.paypal.com but I tried the non-sandbox site too.
<form action="http://sandbox.paypal.com/cgi-bin/webscr" id="paypal_form" method="post" name="paypal_form">
<input name="cmd" type="text" value="_xclick">
<input name="business" type="text" value="some#email.com">
<input name="lc" type="text" value="CH">
<input name="item_name" type="text">
<input name="item_number" type="text">
<input name="amount" type="text">
<input name="currency_code" type="text" value="CHF">
<input name="no_note" type="text" value="1">
<input type="text" name="return" value="http://google.com">
<input name="address_override" type="text" value="1">
<input name="country" type="text" value="CH">
<input name="first_name" type="text">
<input name="last_name" type="text">
<input name="address1" type="text">
<input name="zip" type="text">
<input name="city" type="text">
<input name="email" type="text">
</form>
Since I don't get an error at all, I have no idea what is going wrong. I had cases when Paypal told me that I have to provide a city or something like that but now I just get forwarded.
Note: The Charles Proxy tells me that the form was submitted with these values:
The issue is with the action address in your form. You are posting to "http://sandbox.paypal.com/cgi-bin/webscr". Try using "https://www.sandbox.paypal.com/cgi-bin/webscr" instead.
I'm trying to post two different sets of mixed values. Each form will share some user submitted text like name and email.
<form method="post" action="url1">
<input type="hidden" name="donate" value="food">
<input type="hidden" name="days" value="30">
<input type="text" name="cans" value="5">
<input type="text" name="full_name" value="">
<input type="text" name="email" value="">
<input type="submit" name="submit" value="join1"/>
</form>
<form method="post" action="url1">
<input type="hidden" name="donate" value="shoes">
<input type="text" name="pairs" value="">
<input type="text" name="style" value="">
<input type="text" name="full_name" value="">
<input type="text" name="email" value="">
<input type="submit" name="submit" value="join2"/>
</form>
<possible dropdown>
It would be ideal to have Dropdown select between the two forms and submit.
Well, using only html you will get a problem as a submit button only submit its own form.
It's also not valid to have forms in other forms.
However, is a trick to accomplish your goal using javascript!
With a little function you can e.g. hide all other forms than one:
function showform(index){
var forms = document.forms;
for(var i=0;i<forms.length;i++)
forms[i].style.display=(i==index?"block":"none");
}
Then you only need to add the onchange-event on your dropdown-list and hide one of the forms by default.
This would result in something like this:
<html>
<head>
<style language="css" type="text/css">
form input{display:block;width:100px;}
</style>
<script language="javascript" type="text/javascript">
function showform(index){
var forms = document.forms;
for(var i=0;i<forms.length;i++)
forms[i].style.display=(i==index?"block":"none");
}
</script>
</head>
<body>
<select onchange='showform(this.selectedIndex);'>
<option>form1</option>
<option>form2</option>
</select>
<form method="post" action="url1">
<input type="hidden" name="donate" value="food"/>
<input type="hidden" name="days" value="30"/>
<input type="text" name="cans" value="5"/>
<input type="text" name="full_name" value=""/>
<input type="text" name="email" value=""/>
<input type="submit" name="submit" value="join1"/>
</form>
<form id='form2' style='display:none' method="post" action="url2">
<input type="hidden" name="donate" value="shoes"/>
<input type="text" name="pairs" value="2"/>
<input type="text" name="style" value=""/>
<input type="text" name="full_name" value=""/>
<input type="text" name="email" value=""/>
<input type="submit" name="submit" value="join2"/>
</form>
</body></html>
If you don't like javascript, you would need to do that in php by using an additional form for the select-element and insert only the wanted form (or hide the others).
I already see some design issues with the way you have planned your multi-form setup, there are much better techniques to handle this - but I will try to help you using your own technique.
By using your own example, this should work for you:
<form id="join1" method="post" action="url1">
<input type="hidden" name="donate" value="food">
<input type="hidden" name="days" value="30">
<input type="text" name="cans" value="5">
<input type="text" name="full_name" value="">
<input type="text" name="email" value="">
</form>
<form id="join2" method="post" action="url1">
<input type="hidden" name="donate" value="shoes">
<input type="text" name="pairs" value="">
<input type="text" name="style" value="">
<input type="text" name="full_name" value="">
<input type="text" name="email" value="">
</form>
<select id="formList">
<option value="">Select form..</option>
<option value="join1">Join1</option>
<option value="join2">Join2</option>
</select>
<button id="submitBtn">Submit</button>
And this is the javascript for making it happen (using jQuery):
$('#submitBtn').on('click',function(){
var selectedForm = $('#formList').val();
if(selectedForm){
$('#'+ selectedForm).submit();
}
});
the example is also available as a jsfiddle:
https://jsfiddle.net/k1jf4b4L/
Hope it helps a bit
The 3 forms allow access as member, guest or then as newly registered.
However if someone clicks on the lower part of the form it automatically sends the cursor to the top part.
<form action="schlogin.php" method="post">
<fieldset>
<legend>Member's Login</legend>
<label for="username">Username:
<input type="text" name="username" id="username" value=""/>
</label>
</br>
<label for="password">Password:
<input type="password" name="password" id="password"/>
</label>
</br>
<input type="submit" name="login" class="loginButtons" value="login"/>
</label>
</br>
</fieldset>
</form>
<form action="schlogin.php" method="POST">
<fieldset>
<legend>Guest Player</legend>
<input type="submit" name="guest" class="loginButtons" value="Play as GUEST!" />
</label>
</br>
</fieldset>
</form>
<form action="schlogin.php" method="POST">
<fieldset>
<legend>FAST Register</legend>
<label for="username">Username:
<input type="text" name="username" id="username" value =""/>
</label>
</br>
<label for="password">Password:
<input type="password" name="password" id="password"/>
</label>
</br>
<label for="email">E-mail:
<input type="text" name="email" value=""/>
</label>
</br>
<input type="submit" name="register" class="loginButtons" value="I WANT TO PLAY TOO!"/>
</label>
</br>
I've forgotten my password:
<input type="submit" name="forgotten" class="loginButtons" value="Send me a new password!"/>
</label>
</br>
</fieldset>
</form>
Validate, validate, validate.
You have duplicate id attributes, so the labels in your second form are for the inputs in the first form.
In your second form change
<label for="username">Username:
<input type="text" name="username" id="username" value ="<?php if (isset($username)){echo $username; }?>"/></label></br>
to:
<label for="register_username">Username:
<input type="text" name="username" id="register_username" value ="<?php if (isset($username)){echo $username; }?>"/></label></br>
or whatever you like.
The point is that the id for every html element should always be unique. And the label element's for attribute should match it's associated input element's id attribute.