-1

As I said in the title I need more than 1 action in a form... The form is for a log in script and it's like this:

<form method="post" action="action.php" name="loginform" id="loginform">
 <br><br>
       Username:<br> <input type="text" name="username" id="username" /><br><br>
       Password:<br><input type="password" name="password" id="password" /><br /><br>
        <input type="submit" name="login" id="login" value="Login"  class="page"/>

        <br>
        <br>
        <a href="register.php" class="page">Sign up</a>

    </form>

The action.php page is like this:

<?php
  include('index.php');
  include('insert.php');
  include('contact.php');
  include('about.php');
?>

it seems to work the way I want it mostly but after I hit the log in button it redirects me to action.php page which includes all the pages above... I need this action.php page because if I log in I want to be logged in on all pages, not just one of them. Can I have it redirect to another page or something?

Xiao Yao
  • 3
  • 2

2 Answers2

0

You can redirect to another page from action.php by using the header function

and adding this line to your code

header("Location:www.yourpage.com");

Note: I have used redirect because you said you don't know how to use sessions.

Tanmay Kumar
  • 58
  • 10
  • this doesn't seem to work. it probably redirect me before logging me up. and if I put it after the includes it gives me an error. – Xiao Yao Apr 14 '15 at 16:26
  • Warning: cannot modify header information - headers already sent by(output stated at folder path\index.php:13) in forder path\action.php on line 8 – Xiao Yao Apr 14 '15 at 16:34
  • it somehow works now. I might have done something wrong the first time I did this... thanks a lot. – Xiao Yao Apr 14 '15 at 16:40
  • add _ob_start()_ to the first line of action.php – Tanmay Kumar Apr 14 '15 at 16:42
0

I read that you don't know how to use sessions. Well, I created a Session Wrapper object for my framework. You can learn from it, use it as a base or download it and implement it in your project: https://github.com/yagarasu/crinoline/blob/master/0.1.0a/cr-core/Session.class.php

Hope this helps.