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
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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