NameSilo

Help needed: How to update Php values?

Spaceship Spaceship
Watch

senesh

New Member
Impact
0
Hi

I'm php newbie. For example, I have a php file like this:

php Code:

<?
$value1="content1";
$value2="content2";
?>

Now I want to create a HTML site with 2 input forms allow me change the values (content1, content2) without edit above file manually. I can enter new data and click update button, then it will update new values of above php file.

How do I create this file? There are no SQL DB or complicated functions.

Thank you
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
If you have a form that posts variable to another page, then this is how you would assign the variables. The input boxes in your form would be named value1, and value2, and would post to the page containing the below code. I am not sure if this is what you are looking for or not. Of course, you should always clean an input that a user puts in as well, but this is a basic example.

PHP:
$value1 = $_POST['value1'];
$value2 = $_POST['value2'];
 
0
•••
<form method="post" action="whatever.php">
<input type="text" size="20" maxlength="30" name="text1" />
<input type="text" size="20" maxlength="30" name="text2" />
<input type="submit" value="submit" />
</form>

<?php
$text1 = $_POST['text1'];
$text1 = $_POST['text2'];

echo $text1;
echo $text2;

?>
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back