user2491321
user2491321

Reputation: 673

submit a form with a link from another page

I have created 3 php pages. The 1st includes the following form:

<form method="POST" name="go" action="search_form_all.php"  >
  <input name="value" type="text" id="search_form_1" size="65" placeholder="enter name"/>
  <input type="submit" value="" name="submit" />
</form> 

The 2nd page called "search_form_all.php" includes the php codes that displays the results of the above form. So if the user type a name in form and press submit, the "search_form_all.php" displays all names from my database according to what the user inserts in the search form.

All I want is to have in my 3rd php page a link, that when the user press it to execute the form in 1st page. For example if I enter a name in search form like "john", then I want to be able to go to my third page and press the link, the form to be executed and to return all names "john" from my database. Is this possible?

Upvotes: 0

Views: 1105

Answers (1)

liyakat
liyakat

Reputation: 11853

Yes, this is possible with session variables. An example:

<?php
    session_start();

    if(isset($_SESSION['views'])) {
        $_SESSION['views']=$_SESSION['views'];
    } else {
        $_SESSION['views']=1;
    }

    echo "Views=". $_SESSION['views'];
?>

You can also refer to Document Link

Let me know if you need more help.

Upvotes: 1

Related Questions