I am trying to bring a value from a form in page1.php (form to add data to DB) to page2.php (form to add IMG to DB). I read a whole bunch of pages about how to do that but still can't figure it out.
<form name="formBrokerTour" class="login-form-addproperty" method="post"
action="insertPropertyInfoWITHgeocode.php" onsubmit="return validateForm()">
And then I would need to add several fields, address, city, zip code state. Here one out of 4:
<td width="125" class="formLable">Address</td>
<td width="269" class="formSquare">
<input type="text" class="general_input"
name="address" id="nameText" width="269" >
</td>
page2.php (relevant part) - as you see, if I write an address, that address is addded in the database, so we don't need to worry about sql being wrong. If I try to pass info from page 1 to page 2 either by session (since I have username in place to add info in database) or post/get, address is not added. Interestingly, username is being added.
$username = htmlentities($_SESSION['user']['username'], ENT_QUOTES, 'UTF-8');
$address = "123 abec st";
$query = "
INSERT INTO my_image
(name, size, type, file_path, username, address)
VALUES(?,?,?,?,?,?)";
$conn = $db->prepare($query);
if ($conn == TRUE) {
$conn->bind_param("sissss", $myfile, $fileSize, $fileType, $path, $username, $address);
if (!$conn->execute()) {
echo 'error insert';
} else {
echo 'Success!<br/>';
echo '<img src="' . DISPLAY_PATH . $myfile . '"/>';
}
}
I tried to echo $_session, etc. as we see in other questions, but here is the problem of a new computer person... where do I add this info? I have added it in session_start on the top, just before SQL query and it didn't accept it inside the query.
page1.php has submit button with DB and geocoding stuff. It sends to page3.php where it asks if user wants to add images. If yes, page2.php, if not index. I am getting all confused with passing info.