I have the following: Product name and right after form and submit button. I need to type something in the forms and after clicking submit I want the product name to change.
while ( ! feof( $fp ) ) {
$line = fgets( $fp, 1024 );
list($url, $path) = explode(',', $line);
echo "<div style='width:420px;height:30px;background-color:#2cb823;'>$url</div>";
echo "<div style='width:420px;height:30px;background-color:#2875DE;'>$path</div>";
echo "<div style='width:420px;height:30px;background-color:yellow;'>$default<input type='text'></input>
<button type='button'>Name product</button></div>";
echo "<br/>";
}
As you see the variable $default="Product" is what I want to change via button(by submitting the form).
You can’t change this via PHP directly.
PHP is server-sided code. All of it is already processed at the server before you, the client, gets the code.
If you want to do something like that, you’re going to have to use javascript. If you want this to update at the server, then use Ajax.