Jump to content

Login/Register Page

Recommended Posts

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 by Belendor
Link to post
Share on other sites

I recommend using PHP & Sessions.


<form method="post" action="?action=submit">

<input type"text" name="fname">

<input type="submit" value="submit">


<?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 post
Share on other sites
<!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 by Belendor
Link to post
Share on other sites
  • 2 weeks later...

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 post
Share on other sites

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 by davej
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...