I have a this:
<input type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!">
and then it goes to register/register. I want that it goes to /me, how I can do this?
Musa, welcome to stack overflow!
The submit button does exactly what its name says: It submits a form. Now where the form is submitted to is not a property of the submit button, but of the form.
You will find, that the submit button is part of a <form action="..."> .. </form> construct. By changing the action property of the form, you can point it to another URL, e.g. to ' /me'
The page the input refers to is defined in the action attribute of the <form> not the <input> itself.
<form action="/me" method="get">
Your code must be like this:
<form action="/me" method="post">
<input type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!">
</form>
I'm really confused right now. So, I have <input type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!"> and that I need to change to: <input action="/me" method="get" type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!"> maybe I needed this to say earlier, but it's a registration form, so it needs to be checked if everything is filled in, and it needs to get in the database.
So, I see now that I already had the right code, but it goes to /register/me.. I'm really ashamed...
Another approach would be this:
<input type="button" class="inputlogin submit" style="margin-top: 5px;" value="Maak mijn account en log in!" onclick="parent.location='/me'">
This makes use of onclick and will work without a form. Remember that it doesn't POST a form
<div class="text" style="font-weight:bold;padding:10px;"><?php if(isset($template->form->error)) { echo '<div class="error-messages-holder"><ul><li><p class="error-message">'.$template->form->error.'</p></li></ul></div>'; } ?>
<form method="post" action="{url}/me" autocomplete="off">
<label for="index_rusername">Neem een unieke nickname:</label><br />
<input type="text" placeholder=" Jouw gebruikersnaam " class="inputlogin" name="reg_username"><br />
<label for="index_rpassword">Kies een sterk wachtwoord:</label><br />
<input type="password" placeholder=" Jouw wachtwoord " class="inputlogin" name="reg_password"><br />
<label for="index_rconpassword">Typ je wachtwoord over:</label><br />
<input type="password" placeholder=" Jouw wachtwoord " class="inputlogin" name="reg_rep_password"><br />
<label for="index_remail">Jouw email adres:</label><br />
<input type="text" placeholder=" Jouw e-mail adres " class="inputlogin" name="reg_email"><br />
<input type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!">
</form>
</div>
</div>
I have this code now. But if I press on the button, it doesn't register in the database, so all the configurated things doesn't come in in the table "users".
Related
Hi I’m html learner and I have an issue with my code but I don’t know what’s the problem
The prob is weird , when i enter the right pass in only have my alert « Le mot de passe est correct » but the page is just reload and not move to https://mycool-url.com
This is a simple html code it’s for learn password
<title>Authentification</title>
</head>
<body>
<div class="main">
<p class="sign" align="center">Veuillez vous identifier</p>
<form class="login">
<input class="pass" type="password" align="center" id="password" placeholder="Mot de Passe" type="password" name="pswrd">
<input class="submit" align="center" type="submit" onclick="checkPassword()" value="Login" />
</form>
</div>
<script>
function checkPassword() {
if (document.getElementById('password').value == 'ZhFAIHhyRvBaZ') {
alert('Mot de passe correct')
location.replace('https://www.mycool-url.com');
} else {
alert('Mot de passe incorrect');
return false;
}
}
</script>
</script>
</body>
The form is submitting. If you don't want to submit a form, change the button type from type="submit" to type="button":
<input class="submit" align="center" type="button" onclick="checkPassword()" value="Login" />
If you're not using a "form" at all, you can even just remove the <form> element entirely, which would prevent accidental form submission.
As an aside, it's also worth noting that any user can see the "password" or go directly to the target URL so this authentication mechanism doesn't secure anything.
The form is submitting each time. If you don't want to submit the form, you can use the following things for prevent form submission in your cause.
<input class="submit" align="center" type="submit" onclick="checkPassword(); return false;" value="Login"/>
Change the javascript function checkPassword() to return false all the time.
function checkPassword(){
if(document.getElementById('password').value == 'ZhFAIHhyRvBaZ'){
alert('Mot de passe correct');
window.location.href='https://www.mycool-url.com';
} else {
alert('Mot de passe incorrect');
return false;
}
return false;
}
and call it in onclick like this onclick="return checkPassword();"
<input class="submit" align="center" type="submit" onclick="return checkPassword()" value="Login"/>
It will also prevent the form from submitting.
Replace location.replace('https://www.mycool-url.com'); by window.location.replace("https://www.mycool-url.com");
There was a problem with your submission.
Your submission is missing the secure POST key.
when I am redirected on Wufoo then got the warning or error
I have attached screenshot related error
HTML
<form name="Wufoo Button" accept-charset="UTF-8"
enctype="multipart/form-data" method="post"
action="https://subdomainname.wufoo.com/forms/sponsorchild/">
<!-- Dollars -->
<input id="Field127" name="Field127" type="hidden" t-att-value="Field127" />
<!-- Cents -->
<input id="Field127-1" name="Field127-1" type="hidden" t-att-value="Field1271" />
<!-- Child name and file number -->
<input id="Field125" name="Field125" type="hidden" t-att-value="Field125" />
<input id="saveForm" name="saveForm" class="submit" type="submit" value="Submit" />
</form>
Not sure if you're still stuck on this but I found the answer.
You need to keep this bit of HTML at the end of the form (you can just hide it with css). The value acts as the key:
<li class="hide">
<label for="comment">Do Not Fill This Out</label>
<textarea name="comment" id="comment" rows="1" cols="1"></textarea>
<input type="hidden" id="idstamp" name="idstamp" value="[WUFOO VALUE IS HERE]" />
</li>
So I'm trying to figure out what sends me to another page when I submit this form. frmS.onsubmit = null. Also the submit button doesn't have an on click that sends you to another page. I want to understand how it sends me to the other page and how to stop that.
EDIT: I should add that I want it to send its info that its sending but not throw me on the next page.
EDIT2: SOLVED I've made an iframe and set the form target to that iframe. Thanks Paul Draper
<form name="frmS" method="post" action="/s.aspx?sm=1jFsQEImT6d7s5gJzLre0g%3d%3d" id="frmS">
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWDwL+raDpAgLOhOEnAqrszZoKAsv4g6IHAqDo8XkCqc7S2wcC96SjuQgC+beo3gUCi5yS5QgCsOmqpAECjce8xA0C0I38vQkCnNGksA4Cw/alsQoC1J6ZlwQMnZiKw/euXyNaAEgF3qFMFg5vlA==">
<input type="hidden" name="__VIEWSTATE" id="
__VIEWSTATE" value="">
</div>
<!--content area-->
<div id="PageContentDiv"><div style="text-align:left;"><div class="sLogo"><img class="notranslate" src="http://secure.surveymonkey.com/_resources/4485/45604485/552bd2d8-f3b6-4e1f-b1e5-3c5ea48189b9.gif" alt=""><div class="sExit"><a class="ExitBtn" target="_self" href="http://www.gazette.net/teacher">Exit this survey</a> </div><br class="clear"></div></div><h1 class="sTitle"><div style="text-align:left;float:none;"><span class="notranslate">My Favorite Teacher 2013 - Montgomery County High School</span></div></h1><div class="pTitle"><h2>2. </h2> <br class="clear"></div><div class="pgHdr"><div id="q1" class="question" style="margin:0 0 0 0;width:auto"><div class="qContent"><div class="qHeader"><abbr class="noborder" title="Question 1">1</abbr>. Please provide your name and e-mail address below. Click done below to submit your vote.</div><div class="qBody"><table cellspacing="0" cellpadding="3" border="0" style="width:100%;"><tbody><tr><td style="width:20%;font-weight:bold;"><label for="text_579095901_6719868704"><span class="hlbl">Please provide your name and e-mail address below. Click done below to submit your vote. </span>Name: (Optional)</label></td><td valign="top"><input id="text_579095901_6719868704" name="text_579095901_6719868704" type="text" size="30" value="" class="open"></td></tr><tr><td style="width:20%;font-weight:bold;"><label for="text_579095901_6719868706">Email Address: (Optional)</label></td><td valign="top"><input id="text_579095901_6719868706" name="text_579095901_6719868706" type="text" size="30" value="" class="open"></td></tr></tbody></table></div></div></div></div></div>
<!--end content area-->
<div id="panButtonBar">
<div style="text-align:center;">
<input type="submit" name="PrevButton" value="Prev" onclick="onesubmit(this);" id="PrevButton" class="btn btntext grey">
<input type="submit" name="NextButton" value="Done" onclick="onesubmit(this);" id="NextButton" class="btn btntext grey">
</div>
</div>
<div class="spacer" style="height:100px;"> </div>
<input type="hidden" name="hid_smC0l1d" id="hid_smC0l1d" value="r9nWM11rHijwX3dDZ1G8NQ_3d_3d">
<input type="hidden" name="hid_smRsL1d" id="hid_smRsL1d">
<input type="hidden" name="hid_smRs1d" id="hid_smRs1d" value="mII0H4g5XRCu4s1ZVhHXsg_3d_3d">
<input type="hidden" name="hid_smCSV" id="hid_smCSV">
<input type="hidden" name="hid_smS1d" id="hid_smS1d" value="rbQr6Wx8ieI2e98gDtyjNA_3d_3d">
<input type="hidden" name="hid_smM0D" id="hid_smM0D" value="E6uK1MhOcpBUysyKlC0vrg_3d_3d">
<input type="hidden" name="hid_smV3Rsn" id="hid_smV3Rsn" value="ryjiA1jsXxArHG3rMuiwxg_3d_3d">
<input type="hidden" name="hid_smS3CT1d" id="hid_smS3CT1d" value="IGaEFrQzyw9OHNYpBjkYsg_3d_3d">
<input type="hidden" name="hid_DC" id="hid_DC" value="UTLbMdg3R07bopsDbKUHM51JeIvWdftG8_2bHZNxxsXT_2bITWvXP9m1Zy_2fqRmNPpOx7">
<input type="hidden" name="Hidden_CollectorToken" id="Hidden_CollectorToken">
<input type="hidden" name="Hidden_Simple" id="Hidden_Simple">
<input type="hidden" name="hid_l04dez" id="hid_l04dez" value="RsDrTe_2b1IjsIQj68b5l2TrRCB0SORAXCRx0_2bpMErNSQ_3d">
<div>
</div></form>
The first line sends you to another page -
<form name="frmS" method="post" action="/s.aspx?sm=1jFsQEImT6d7s5gJzLre0g%3d%3d" id="frmS">
You're being sent to the URL specified in the action attribute of your form.
You are getting a redirect response from your server (assuming that the action on your form is your current page; if not, you are going there).
If you want to submit a form without navigating, create an iframe, and set the target attribute of your form to the iframe.
I have a problem with a form. It is not sending any action (page not even refreshing on click). If I copy the form in another document locally it has no problem, all working well, mail message being sent. Here is the code of the form:
<form method='post' name='ContactForm' id='contactForm' action='contact_main.php'>
<p>Your name:</p>
<input type="text" class="input-box" name="user-name" placeholder="Please enter your name.">
<p>Email address:</p>
<input type="text" class="input-box" name="user-email" placeholder="Please enter your email address.">
<p>Subject:</p>
<input type="text" class="input-box" name="user-subject" placeholder="Purpose of this message.">
<p class="right-message-box">Message:</p>
<textarea class="input-box right-message-box message-box" name="user-message" placeholder="Your message."></textarea>
<button type='submit' class='myinputbtn' name='submitf' id="submitf">Send your message</button>
<div id='message_post'></div>
<input type="hidden" name="contact">
</form>
Clicking the submit button results in... nothing!
Please let me know if I need to edit my question before downrating. Thanks!
Use
<input type="submit" ...
instead of a button (which is used with Javascript, not for form submitting)
I have just finished putting a login and register bit on my website and now I'm just cleaning things up, but then I came to this problem I have two form action's on one page, each one goes to a different page, easy enough, but I can't seem to get them both on one line.
Here is the code for the form actions:
<form action='logout.php' method='POST'>
<input type='submit' value='Logout' />
</form>
<form action='changepassword.php' method='POST'>
<input type='submit' value='Change password' />
</form>
I've tried
<form action='logout.php' method='POST'>
<input type='submit' value='Logout' />
<form action='changepassword.php' method='POST'>
<input type='submit' value='Change password' />
</form>
but both buttons go to the same location
the website is www.crossception.com, you will need to login to get to this problem
I've already made a login and password for every one to use
username : stackoverflow
password : test101
thank you very much
connor
(aged 15)
<span style="float:left;">
<form action='logout.php' method='POST'>
<input type='submit' value='Logout' />
</form>
</span>
<span style="float:right;">
<form action='changepassword.php' method='POST'>
<input type='submit' value='Change password' />
</form>
</span>
If I understand your question properly, I think you need to use some CSS:
form {
float: left;
width: auto;
}
You might want to add a class to those forms to stop yourself styling all forms like this
Here's the dirty inline version
<form action='logout.php' method='POST' style='float:left;'>
<input type='submit' value='Logout' />
</form>
<form action='changepassword.php' method='POST'>
<input type='submit' value='Change password' />
</form>
Of course James's suggestion to use a class is the proper way to do it.
Btw, those forms should be after the opening body tag.