Let's see if I understand correctly:
You have a FORM that sends a data for POST ... and you want that FORM to tie the password input with a variable of a PHP file.
If this is how I understand you, it's simple:
Do an include of your file urls/miarchivo.php
, hence the variable $ password that is in miarchivo.php
is already accessible, in case there is a problem at most you can include it to become global ( global $password
) and ready is comparable.
Let's see it in code (remember, this code is simple you should not use it for security and so on):
<?php
include("urls/miarchivo.php"); //se incluye el archivo donde se encuentra la variable $password
$passwordDelForm = $_POST['password']; //esta es la contraseña que manda el form
if($passwordDelForm != ""){ //se checa que no esté vacía
if($passwordDelForm == $password){ //si empatan las variables
echo "Contraseña correcta";
}else{ //si no empatan
echo "Error en la contraseña";
}
}else{ //si está vacía le mostramos un error
echo "Error en la contraseña";
}
?>
You can corroborate after the include by tests printing the variable to see if it loads you and it does not have problems of accessibility, in case this is only as mentioned
<?php
global $password = "holamundo";
?>
I hope you serve, greetings and luck.