Difference between and

<input type=”button” /> buttons will not submit a form – they don’t do anything by default. They’re generally used in conjunction with JavaScript as part of an AJAX application. <input type=”submit”> buttons will submit the form they are in when the user clicks on them, unless you specify otherwise with JavaScript. The first submit button … Read more

input() error – NameError: name ‘…’ is not defined

TL;DR input function in Python 2.7, evaluates whatever your enter, as a Python expression. If you simply want to read strings, then use raw_input function in Python 2.7, which will not evaluate the read strings. If you are using Python 3.x, raw_input has been renamed to input. Quoting the Python 3.0 release notes, raw_input() was … Read more

Is well formed without a ?

<input> without a <form> appears valid, yes (at least for html 4.01, look near the end of 17.2.1): The elements used to create controls generally appear inside a FORM element, but may also appear outside of a FORM element declaration when they are used to build user interfaces. This is discussed in the section on … Read more

Change default text in input type=”file”?

Use the for attribute of label for input. <div> <label for=”files” class=”btn”>Select Image</label> <input id=”files” style=”visibility:hidden;” type=”file”> </div> Below is the code to fetch name of the uploaded file $(“#files”).change(function() { filename = this.files[0].name; console.log(filename); }); <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <div> <label for=”files” class=”btn”>Select Image</label> <input id=”files” style=”visibility:hidden;” type=”file”> </div>

Why does the html input with type “number” allow the letter ‘e’ to be entered in the field?

Because that’s exactly how the spec says it should work. The number input can accept floating-point numbers, including negative symbols and the e or E character (where the exponent is the number after the e or E): A floating-point number consists of the following parts, in exactly the following order: Optionally, the first character may … Read more

PHP “php://input” vs $_POST

The reason is that php://input returns all the raw data after the HTTP-headers of the request, regardless of the content type. The PHP superglobal $_POST, only is supposed to wrap data that is either application/x-www-form-urlencoded (standard content type for simple form-posts) or multipart/form-data (mostly used for file uploads) This is because these are the only … Read more

How to read a single character from the user?

Here’s a link to the ActiveState Recipes site that says how you can read a single character in Windows, Linux and OSX:     getch()-like unbuffered character reading from stdin on both Windows and Unix class _Getch: “””Gets a single character from standard input. Does not echo to the screen.””” def __init__(self): try: self.impl = _GetchWindows() except … Read more

How to change the button text of ?

Use Bootstrap FileStyle, which is used to style the file fields of forms. It is a plugin for a jQuery-based component library called Twitter Bootstrap Sample usage: Include: <script type=”text/javascript” src=”https://stackoverflow.com/questions/1944267/js/bootstrap-filestyle.min.js”> </script> Via JavaScript: $(“:file”).filestyle(); Via data attributes: <input type=”file” class=”filestyle” data-classButton=”btn btn-primary” data-input=”false” data-classIcon=”icon-plus” data-buttonText=”Your label here.”>

onchange event on input type=range is not triggering in Firefox while dragging

Apparently Chrome and Safari are wrong: onchange should only be triggered when the user releases the mouse. To get continuous updates, you should use the oninput event, which will capture live updates in Firefox, Safari and Chrome, both from the mouse and the keyboard. However, oninput is not supported in IE10, so your best bet … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)