#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2008
    Posts
    768
    Rep Power
    41

    simple form posts to same page


    I have a form, that posts to the same page. If the form variables are in the $_POST, other info from the database is displayed instead of the form.

    The issue is that the form doesn't post to the same page, it basically does nothing on submit.
    Here ids the code:
    Code:
    <div id="distributor-form">
    
    
    	 <form class="forms contact-form" id="form1" action="distributor-login.php" method="post"> 
    								
    								<div class="row">
    									<div class="col-sm-6 name-field">
    										<input type="text" name="email" class="defaultText required username" title="Email (Required)"/>
    									</div><!-- /.col -->
    								</div><!-- /.row -->
                                    
                                    <div class="row">
    									<div class="col-sm-6 name-field">
    										<input type="text" name="psswd" class="defaultText password" title="Password"/>
    									</div><!-- /.col -->
    								</div><!-- /.row -->
    								
    								</form>
    								 <button type="submit" class="btn btn-default btn-submit" value="submit">Login</button>
    Any ideas?

    thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2016
    Posts
    75
    Rep Power
    4
    You would want to put the submit button inside the form.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2008
    Posts
    768
    Rep Power
    41
    hi DSmabismad, thanks for the reply. Made the change, and still nothing on "submit." Downloaded the file to make sure the change was uploaded, looks right, but doesn't work.

    sample::
    Code:
     <div class="row">
    									<div class="col-sm-6 name-field">
    										<input type="text" name="psswd" class="defaultText password" title="Password"/>
    									</div><!-- /.col -->
    								</div><!-- /.row -->
    								 <button type="submit" class="btn btn-default btn-submit" value="submit">Login</button> 
    								</form>
    really not sure what's up.

    -Sean
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2016
    Posts
    75
    Rep Power
    4
    That change submits the form for me, in the latest Chrome and Firefox browsers on windows, with just that html on the page, no doctype.

    If a <button></button> actually submits a form is a html5 feature and is dependent on the doctype of the page.

    It could also be that your form processing code is looking for a form field name that doesn't exist. Only the "email" and "psswd" fields have names in your form and only those two will exist in the $_POST data.

    You could also have some javascript involved that is preventing the form from being submitted.

    Edit: you could also have another opening <form> tag, using method='get', above the one you are showing, without a closing </form> tag and the one you are showing us isn't in affect.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2008
    Posts
    768
    Rep Power
    41

    Thumbs up yes, thanks


    Thanks DSmabismad, I will check all the factors, thought I was losing my mind : )
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Location
    Ahmedabad
    Posts
    17
    Rep Power
    0
    Hi,

    you can use this trick to your problem solve
    Code:
    <html><head><title>Simple Form Post to Same Page</title></head><body><form action=" ">Name<input type="text"><input type="button" value="submit/></form></body></html>
    Thanks

IMN logo majestic logo threadwatch logo seochat tools logo