When i run the following code below it works in dreamweaver but when i go to view it in a web broswer nothin shows.
The code is
<table cellpadding="5" cellspacing="1">
<tr>
<td align="center">
<form action="search.php" method="get">
<table><tr><td>
<input type="text" name="query" id="query" size="40" value="<? print quote_replace($query);?>" action="include/js_suggest/suggest.php" columns="2" autocomplete="off" delay="1500">
</div>
<td>
<input type="submit" value="Search!">
</td></tr></table>
When i go to view the source code in chrome it only loads
<table cellpadding="5" cellspacing="1">
<tr>
<td align="center">
<form action="search.php" method="get">
<table><tr><td>
Check with your host to see if they've enabled the <? tag. It's not turned on by default. If it's not, it's probably causing Chrome a lot of grief.
Check out your syntax. What you've pasted isn't valid. It looks like your'e closing your form twice, or you have an extra set of quotes in the "get" area.
On a side note, I suggest removing display related HTML attributes in favor of CSS. It will help keep a clear distinction between function and look.
Related
How to remove the action attribute in the form tag. I want to find a way to submit the form to the existing "process_login.php.php" without the action attribute. Please don't use any JavaScript.
<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
</head>
<body>
<h1>Login Form</h1>
<hr>
<form action="http://corneyx.com/process_login.php" method="post">
<table border="1" cellpadding="10">
<tr>
<td>Username:</td>
<td><input type="text" name="username" required></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" required></td>
</tr>
</table>
<hr>
<!-- put your buttons here -->
<input type="hidden" name="matricnum" value="???????">
<input type="submit" name="login_form" value="Login">
<input type="reset">
</form>
</body>
</html>
???
I understand that some would like to remove the action attribute from the <form> tag.
However, not allowing JavaScript??
Sorry, there is just no way. It is just not designed that way.
Here is a W3.org link regarding <form> tag if you're interested looking into vanilla HTML <form> and what you can do with them.
Unless you create your own browser which allows that, but let's be honest, that would defeat the purpose anyways.
It is possible to leave the action attribute blank and use ajax, but if you don't want to use JavaScript you're stuck
for some reason my mail to function does not seem to work in android devices.... i'm really confused what to do as it seems to be working fine on windows devices
<article class="contact_form">
<h2><i>Reach Me</i></h2>
<table class="contact-table">
<form action="mailto:sanwal.sahil#yahoo.com" method="post" enctype="multipart/form-data" name="EmailTestForm">
<tr>
<td><label for="name">Name:</label></td>
<td>
<input type="text" id="name" name="visitor" />
<br>
<br>
</td>
</tr>
<tr>
<td colspan="2">
<button type="submit" colspan="1" class="form-submit">SUBMIT</button>
</td>
</tr>
</form>
</table>
</article>
mailto:, in general, has very unreliable support as a form action. This is likely just one more example of that. You should avoid it entirely in favour of using an HTTPS (or even HTTP) URL with a server side form handler.
Additionally, your form is invalid in a way that will break it in a number of browsers. Write valid HTML.
I am playing with the Spring validating form input example - java spring mvc with Thymeleaf views. I have been able to pass messages into the view without issue. These display where the example wants them to...
e.g.
<td th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Name Error</td>
I am trying to find a way to put them into the html input validation attributes though so I have tried the following (full page below)
<td><input type="text" th:field="*{age}" **required="required" data-errormessage-value-missing="${#fields.errors('age')}" data-errormessage="${#fields.errors('age')}"**/></td>
This has done no good though and the validation message displayed is ${#fields.errors('age')} ! Is there a way to push the binding errors into the attribute or am I misunderstanding the way it works ?
Thanks for any help in advance.
Page html
<html>
<body>
<form action="#" th:action="#{/}" th:object="${personForm}" method="post">
<table>
<tr>
<td>Name:</td>
<td><input type="text" th:field="*{name}" required="required" data-errormessage-value-missing="Custom Message" /></td>
<td th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Name Error</td>
</tr>
<tr>
<td>Age:</td>
<td><input type="text" th:field="*{age}" required="required" data-errormessage-value-missing="${#fields.errors('age')}" data-errormessage="${#fields.errors('age')}"/></td>
<td th:if="${#fields.hasErrors('age')}" th:errors="*{age}">Age Error</td>
</tr>
<tr>
<td><button type="submit">Submit</button></td>
</tr>
</table>
</form>
</body>
</html>
Thymeleaf only evaluates attributes that start with th:, so in order to do this, you have to use th:attr. You're tag should look like:
<input type="text" th:field="*{age}" required="required" th:attr="data-errormessage-value-missing=${#fields.errors('age')}, data-errormessage=${#fields.errors('age')}" />
You could also use this plugin to evaluate data tags, but I've haven't used it before so I can't comment on how well it works: https://github.com/mxab/thymeleaf-extras-data-attribute
I read several articles, but couldn't really get things working. Here's what I'm talking about. The Html of a webpage:
<form id="LOGINFORM" name="LOGINFORM" style="margin:0px; padding:0px;" action="login.php" method="post">
<table cellspacing="2" cellpadding="0" border="0" width="100%">
<tr>
<td width="100" align="center" valign="bottom">
Username:
</td>
<td width="100" align="center" valign="bottom">
Pass:
</td>
<td valign="top" align="right">
</td>
</tr>
<tr>
<td align="center">
<input class="inputbox" style="text-align:center; width:90px;" maxlength="12" name="loginname" type="text" size="12">
</td>
<td align="center">
<input class="inputbox" style="text-align:center; width:90px;" maxlength="12" name="password" type="password" size="12">
</td>
<td align="left">
<input
class="button_ok"
name="btnSubmit"
id="btnSubmit"
type="submit"
value="Вход"
onclick=""
>
</td>
</tr>
</table>
</form>
say the webpage is helloworld.com, account is foo, pass is bar.
What I browse: helloworld.com/login.php?loginname=foo&password=bar
But server returns that username/password is wrong, but they aren't. What do I do wrong?
The logic in login.php says that loginname=foo&password=bar is wrong. That is where you need to look to find out why it doesn't work.
As for what is wrong with the HTML.
You are using a table for layout
You aren't using <label> elements to label your inputs
You having given a form a name, these days an id is all that is required (and then only if you need to reference it with JS or CSS)
You are using a style attribute instead of a seperate stylesheet, and quite a few obsolete presentational attributes (such as align, width and cellspacing)
that form secifies that the data is passed via POSt, and not GET as you are trying to pass it. If a form wants data back specifically as POST data, that page will ignore GET data. see this tutorial
Your HTML says method="post", so I guess the server will only accept those values by the POST method. When you browse that URL, you are sending them using the GET method.
You are confusing GET and POST in PHP:
$_GET['loginname'] will retrieve a query string variable.
$_POST['loginname'] will retrieve the value of the input named "loginname". (This is what you need.)
helloworld.com/login.php?loginname=foo&password=bar uses GET
In my jsp code I use the request.getParameter() to retrieve the data which is entered in html. The data was retrieved when using get method but it is not when im using post method
Why this happend
My html form is
<code>
<form name="inp" action="upload.jsp" method="post" onsubmit="return valid();" enctype="multipart/form-data">
<table align="center" cellspacing="2">
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td><font size="5" color="#E41B17">Select File</font> </td>
<td><input type="file" name="infile"></td>
</tr>
<tr><td><font size="5" color="#E41B17">Target File Name</font></td>
<td><input type="text" size="20" name="filename"></input></td>
</tr>
<tr></tr>
<tr><td colspan="2" align="center"><input type=submit value="Upload" ></td></tr>
</table>
<br></br>
<center>
<font color="#E41B17">HOME</font>
</center>
</form>
</code>
And my jsp scriptlet is
<% String f = request.getParameter("filename");
System.out.println(f); %>
Thanks in Advance
Now to the issues: you've set the form's content type to be multipart, which means that you have to explicitly parse the request body; the container will only parse if you leave the default form-encoded. This article seems to give an example of how to access multipart data on the server side.
Aside from that, you do realize that your form is commented-out, so should never be handled by your browser, right? If you're actually seeing something on the browser, it probably isn't coming from this location.