mysql - Pass value between different pages (form) with PHP -
i trying bring value form in page1.php (form add data db) page2.php (form add img db). read whole bunch of pages how still can't figure out.
<form name="formbrokertour" class="login-form-addproperty" method="post" action="insertpropertyinfowithgeocode.php" onsubmit="return validateform()">
and need add several fields, address, city, zip code state. here 1 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) - see, if write address, address addded in database, don't need worry sql being wrong. if try pass info page 1 page 2 either session (since have username in place add info in database) or post/get, address not added. interestingly, username being added.
$username = htmlentities($_session['user']['username'], ent_quotes, 'utf-8'); $address = "123 abec st"; $query = " insert 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 echo $_session
, etc. see in other questions, here problem of new computer person... add info? have added in session_start
on top, before sql query , didn't accept inside query.
page1.php has submit button db , geocoding stuff. sends page3.php asks if user wants add images. if yes, page2.php, if not index. getting confused passing info.
all of fields form in $_post. extract address with
$address = $_post['address'];
if passing variables form action or via url, use $_get.
i'd suggest looking @ tutorial sites or php book, 1 of basic things learn.
Comments
Post a Comment