hpw to store a permanent value in php variable?
for eg input.php
<form action = "output.php" method = "post">
<input type = "text" name = "q">
<input = "submit">

</form>

now output.php
<?php $a = $_POST['q']; echo $a;?>
now when we upload output.php in new tab it has no value can i use storage classes for permently store data.

Recommended Answers

All 5 Replies

You forgot the <input type="submit" /> at the end of your form.. What I mean is you just wrote ="submit" without the 'type' identifier

EDIT: you could also use

<button type="submit"></button>

Aside from that mistake.. HTTP POST requests don't inherently allow for persistence. You need to have either a database, write your data to a file, or store it in a session variable to achieve what you want.

yea Sir its true but it still not permanently storing value?

Read what I said above:

Aside from that mistake.. HTTP POST requests don't inherently allow for persistence. You need to have either a database, write your data to a file, or store it in a session variable to achieve what you want.

Sir is there any type of storage classes which can store data to hard disk?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.