Belendor Posted January 24, 2014 Share Posted January 24, 2014 (edited) Hello, Basicly, I am so new to HTML5 and trying to learn thanks to the great repository of this site. Right now I am trying to create a simple login/register page. And I want it to do return me the value written in input field as in a (print) perhaps when clicked any of the buttons, there is no arguement with the silliness of the page, buttons here and there...the main reason I did this was to give each button something to test so don't bother with it. But I still can't understand the structure of the HTML5. What should I do? Thanks in advance. <!DOCTYPE html><html><head><title>A BASIC HTML FORM</title><?PHP$username = $_POST['username'];print ($username);?></head><body><center><FORM NAME ="form1" METHOD =" " ACTION = ""><INPUT TYPE = "TEXT" VALUE =" "><INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login"><input type="Submit" formtarget="_blank" value="Login as a new window"><INPUT TYPE = "Submit" Name = "Submit2" VALUsE = "Register"></FORM></center></body></html><form action="demo_form.asp"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <input type="submit" value="Submit"></form> Edited January 24, 2014 by Belendor Link to comment Share on other sites More sharing options...
MarkT Posted January 24, 2014 Share Posted January 24, 2014 I recommend using PHP & Sessions. <form method="post" action="?action=submit"> <input type"text" name="fname"> <input type="submit" value="submit"> </form> <?PHP if($_GET['action'] == "submit") { $_SESSION['fname'] = $_POST['fname']; } ?> put <?PHP session_start(); ?> before <html> Where you want name put: <?PHP echo $_SESSION['fname']; ?> Link to comment Share on other sites More sharing options...
Belendor Posted January 27, 2014 Author Share Posted January 27, 2014 (edited) <!DOCTYPE html><html><head><title>JavaScript Basics</title><meta charset="utf-8"><script type="text/javascript">function displayContent(type){if (type == "show"){document.getElementById("container_name").innerHTML = document.getElementById("holder_name").value;}else if (type == "delete"){document.getElementById("container_name").innerHTML = "";document.getElementById("holder_name").value = "";}else{// Do somethingconsole.log("Type is not executable.");}}</script></head><body><div style="margin-top: 40px; margin-left: auto; margin-right: auto; width: 400px; text-align: center;"><input id="holder_name" type="text" name="name"><br><br><div style="margin-left: auto; margin-right: auto; width: 230px;"><input type="submit" value="Gönder" onclick="displayContent('show');" style="width: 100px; float: left;"><input type="submit" value="Sil" onclick="displayContent('delete');" style="margin-left: 30px; width: 100px; float: left;"></div><br><br><div id="container_name"></div></div></body></html> Nope, I don't need this form to return data from somewhere of internet. Think I solved it myself with a bit of help. Any thoughts? Edited January 27, 2014 by Belendor Link to comment Share on other sites More sharing options...
davej Posted January 27, 2014 Share Posted January 27, 2014 I don't know what you are trying to do. Your last post has little or nothing to do with your first post above. Link to comment Share on other sites More sharing options...
lanphuong23 Posted January 28, 2014 Share Posted January 28, 2014 Hi. i don't know, Because i done HTML and CSS./ Link to comment Share on other sites More sharing options...
Mudsaf Posted January 30, 2014 Share Posted January 30, 2014 Without PHP & SQL you can't really make safe login for your page. Also form GET method isn't secure way to do it. Here is some tutorial how to make login with SQL: http://www.phpeasystep.com/phptu/6.html Link to comment Share on other sites More sharing options...
Belendor Posted February 7, 2014 Author Share Posted February 7, 2014 Thank you for the replies. I am not trying to get into complex stuff but instead trying to learn what does what really. So this form page, is not for any complex purpose but only self training myself for getting what user writes in textbox and nothing else. That is what I tried to state. Link to comment Share on other sites More sharing options...
davej Posted February 7, 2014 Share Posted February 7, 2014 (edited) The basic idea is that HTML, CSS, and Javascript exist and run in the browser on your machine. The server sends those files to the browser and they run in the browser. The user can then send a form (by GET or by POST methods) to a file on the remote server where server-side code can process and store the form data or use the form data to retrieve other data which can then be sent back to the browser. Edited February 7, 2014 by davej Link to comment Share on other sites More sharing options...
Belendor Posted February 11, 2014 Author Share Posted February 11, 2014 I see. I will give a few tests then. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now