Well, it's been killing for a while now. I am very new to PHP and have been able to get some of the code runnin the way I want it to, but the rest is really complicated. I am working on a website for a friend's company and I made a form so he can submit info and pictures. Now, this form comes out in a popup and then when it's done it closes and refreshes the parent page in order to output that information. The process is something like this: index.php -> form.php(popup) -> upload-script.php(data goes to db in MySQL) -> form.php closes then index.php refreshes to show information. I was able to get the process running, and the output too by using sessions, BUT I want that info to stay there, and be able to loop so that old information moves down, and the new one on top. What I want to achieve is something like, let's say, a comment box, where whatever is types on the text area outputs a certain way. Here's the script for the upload code:
And here is the one for the output:
<?php session_start(); $mlsnum = $_SESSION['mlnum']; $address = $_SESSION['address']; $price = $_SESSION['price']; $street = $_SESSION['street']; $status = $_SESSION['status']; $beds = $_SESSION['beds']; $yb = $_SESSION['year_built']; $city = $_SESSION['city']; $prop = $_SESSION['property_type']; //The code above uses sessions a session is PHP's way of displaying information regardless of which page a user is on. //Log in scripts use them that is how once logged in your username can be echoed throughout the site. ?><html> <head> <title>Database submission scripts</title> </head> <body> <h4>Your site and DB connection script test page.</h4> <form method="POST" action="guyscode.php"> <!--Action="" makes the form submit data to a certain page. method="post" makes PHP submit it as a post session.--> <i>MLNUM</i><input type="text" name="mlnum" /><br /> <i>Address</i><input type="text" name="address" /><br /> <i>Price</i><input type="text" name="price" /><br /> <i>Street</i><input type="text" name="street" /><br /> <i>Status</i><input type="text" name="status" /><br /> <i>Beds</i><input type="text" name="beds" /><br /> <i>Year</i><select name="year_built"> <option>1989</option> <option>1988</option> <option>1987</option> <option>1986</option> <option>1985</option> <option>1984</option> </select><br /> <i>City</i><input type="text" name="city" /><br /> <i>Type</i><input type="text" name="property_type" /><br /> <input type="submit" /> </form> <p>__________________________________________________</p> <?php echo " $mlsnum $address $price $street $status $beds $yb $city $prop "; // The variables above are what is used to echo out the content a user entered into the form. //echo is PHP's way of displaying information to the user. ?> <p>__________________________________________________</p> <p> Hi this is your code you asked for I have also included a log in script for users and register script if you so need them. Please note these scripts contain no security. </p> </body></html>
As you can see I am using sessions so the info migrates, but I am not sure if they are the right ones to use or not. All that info from the sessions is what I want to be posted in a loop. It works to migrate the info, but unfortunately it dissappears when I close the browser and open the page again. Any suggestions?