Jump to content

Recommended Posts

I have a simple form

 

<label for="username" name="username">Username or email</label>
        <input id="username" name="username" value="" title="username" class="required" tabindex="4" type="text">
        </p>
        <p>
          <label for="password" name="password">Password</label>
          <input id="password" name="password" value="" title="password" class="required" tabindex="5" type="password">
        </p>
        <p class="clear"></p>
        <a href="change_password.php" class="forgot" id="resend_password_link">Forgot your password?</a>
        <p class="remember">
          <input id="submit" value="Sign in" tabindex="6" name="submit" type="submit">
          <input id="cancel_submit" value="Cancel" tabindex="7" type="button">
[/code

the action is set for includes/handle_form.php and in the handle form, I am just trying to test that I can get the username and password and then echo out the results. Am I doing it wrong?

[code]
if(isset($_POST['submit'])){
$name = $_POST['username'];
$pass = $_POST['password'];

echo "$name ."". $pass";
}

Link to comment
https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/
Share on other sites

i dont see any form tags. you have to wrap input and other form tags with <form></form> tags, like so

<form method="post" >
<label for="username" name="username">Username or email</label>
        <input id="username" name="username" value="" title="username" class="required" tabindex="4" type="text">
        </p>
        <p>
          <label for="password" name="password">Password</label>
          <input id="password" name="password" value="" title="password" class="required" tabindex="5" type="password">
        </p>
        <p class="clear"></p>
        <a href="change_password.php" class="forgot" id="resend_password_link">Forgot your password?</a>
        <p class="remember">
          <input id="submit" value="Sign in" tabindex="6" name="submit" type="submit">
          <input id="cancel_submit" value="Cancel" tabindex="7" type="button">
</form>

um, you use a submit button to do that. but it appears as if you already have to submit button. post your whole form's code, but im going to sleep soon so if you don't have this solved by tommorow I can take a look at it again

<fieldset id="signin_menu">
      <span class="message">Please verify your account before continue</span>
      <form method="post" id="signin" action="handle_form.php">
        <label for="username" name="username">Username or email</label>
        <input id="username" name="username" value="" title="username" class="required" tabindex="4" type="text">
        </p>
        <p>
          <label for="password" name="password">Password</label>
          <input id="password" name="password" value="" title="password" class="required" tabindex="5" type="password">
        </p>
        <p class="clear"></p>
        <a href="change_password.php" class="forgot" id="resend_password_link">Forgot your password?</a>
        <p class="remember">
          <input id="submit" value="Sign in" tabindex="6" name="submit" type="submit">
          <input id="cancel_submit" value="Cancel" tabindex="7" type="button">
        </p>
      </form>
      </fieldset>

 

that is all the code. I have the doctype in the header.php with an include in the top of the index. with the form. then the footer.php included also. I have the php code for the form in the handle_form.php

 

a simple test was all I was trying to do to make sure it was working. Then I was going to try to learn how to do the rest of the validation as the days go on.

I packaged up the whole thing. You can download it here

 

http://www.photobyiris.com/login.zip

 

I stripped out all the javascript and the code started working. as it is, the php don't work, but If I remove everything but the form code, the php starts working. Thanks for your help.

well, I deleted that bit of code becuase it doesn't really need to be there. The submit buttons works now but I still can not get anything out of the php code. I tried just a simple one

 

<?php 

if(isset($_POST['submit'])){


header('location: newpage.php');

}
?>

 

it just throws a # sign onto the end of the address

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.