Jump to content

Form input storing as permanent variable


joeholdcroft

Recommended Posts

Is there a way to make a form input into a permanent variable, that can then be used on any other pages as long as the file they're stored in is included.

For example:

An installation file: the first page is where the user would input their MySQL Host, Username, Password and Database. Then I want the page to save this information to a config.php file, which can then be included on all the pages that need to correspond with the database using this information. Then on the second installation page, the tables would be inserted to the database, ect.

Just the only thing i'm not sure how to do is the permanent variable storing, how would I go about this?

Many thanks!! :)
Link to comment
https://forums.phpfreaks.com/topic/9184-form-input-storing-as-permanent-variable/
Share on other sites

You'd want something like this:

[code]
<form action="form.php" method="post">
<p><input type="text" name="host" />
<p><input type="text" name="user" />
<p><input type="text" name="password" />
<p><input type="submit" value="hit it!" />
</form>

<?php
$host = $_POST['host'];
$user = $_POST['user'];
$password = $_POST['password'];
?>
[/code]

Archived

This topic is now archived and is closed to further replies.

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