I have a bunch of undefined variables, for all the variables of a profile page I'm trying to create.
I thought i had defined them previously, as seen below. I looked on similar posts, but initializing the variables does not seem to be working either(I tried with $first as you can see). I'm a newcomer to php, so any help would be greatly appreciated :)
<?php
include_once 'Header.php';
?>
<?php
$uid = (isset($conn, $_POST['user_uid']) ? $_POST['user_uid'] : '');
$result = mysqli_query($conn, "SELECT * FROM users where user_uid='$uid'");
while($row = mysqli_fetch_array($result))
{
$first= "";
$first = $_POST['first'] ?? '';
$last= mysqli_real_escape_string($conn, $_POST['last']);
$city= mysqli_real_escape_string($conn, $_POST['city']);
$country= mysqli_real_escape_string($conn, $_POST['country']);
}
?>
<?php
include_once 'Footer.php';
?>
<table width="398" border="0" align="center" cellpadding="0">
<tr>
<td height="26" colspan="2">Your Profile Information </td>
<td><div align="right"><a href="index.php">logout</a></div></td>
</tr>
<tr>
<td width="129" rowspan="5"><img src="<?php echo $picture ?>" width="129"
height="129" alt="no image found"/></td>
<td width="82" valign="top"><div align="left">FirstName:</div></td>
<td width="165" valign="top"><?php echo $first ?></td>
</tr>
<tr>
<td valign="top"><div align="left">LastName:</div></td>
<td valign="top"><?php echo $last ?></td>
</tr>
<tr>
<td valign="top"><div align="left">City:</div></td>
<td valign="top"><?php echo $city ?></td>
</tr>
<tr>
<td valign="top"><div align="left">Country:</div></td>
<td valign="top"><?php echo $country ?></td>
</tr>
</table>
<p align="center"><a href="index.php"></a></p>
Signup form:
<?php
include_once 'Header.php';
?>
<section class="main-container">
<div class="main-wrapper">
<h2>Sign Up</h2>
<form class="signup-form" action="includes/signup-inc.php" method="POST">
<div class="mainbox">
<div class="btncontainer">
<input id="radbtn1" type="radio" name="type" value="Guide" checked><br>
<label for="radbtn1"><span class="radio">Client</span></label>
</div>
</div>
<div class="mainbox">
<div class="btncontainer">
<input id="radbtn2" type="radio" name="type" value="Trainer"><br>
<label for="radbtn2"><span class="radio">Trainer</span></label>
</div>
</div>
<input type="text" name="first" placeholder="Firstname">
<input type="text" name="last" placeholder="Lastname">
<input type="text" name="email" placeholder="E-mail">
<input type="text" name="uid" placeholder="Username">
<input type="password" name="pwd" placeholder="Password">
<input type="text" name="street" placeholder="Street(not visible)">
<input type="text" name="postcode" placeholder="Postcode(not visible)">
<input type="text" name="city" placeholder="City(not visible)">
<input type="text" name="region" placeholder="Region">
<input type="text" name="country" placeholder="Country">
<input type="text" name="phonenumber" placeholder="Phone number(not
visible)">
<button type="submit" name="submit">Sign Up!</button>
</form>
</div>
</section>
<?php
include_once 'Footer.php';
?>