-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
ahh, your using a table....try changing "Number of Bedrooms" to "No. of Bedrooms". I'm off for today, research $_POST and have a look on my blog - ( http://muddy-dev.blogspot.co.uk/ ) there is a section on there that covers simple SQL using JOINS, your going to need to know that for the results page.
-
it words on any tag, I thought that it was the submit button that was falling off. use it on a select, a table, a div, pretty much anything : <select name="name" style="width:80px;"> || <input type="submit" name="submit" value="Click Me" style="width:80px;" /> || <table border="1" style="width:80px;"> || <ul style="width:80px;"> you get the idea
-
try it and see
-
you can add style='width:**px;' to the submit tag to set the width, I think you are already doing it on the areas select... Let's see what you coded for the property_type select
-
"<option value\"$minPrice000\">£$minPrice,000</option>"; will fix that, also I have taken the ' out of the value = (having thought about it some this will be for the best)
-
your database is totaly insuficcient for the task you want to perform. You will need multiple tables and relational fields.
-
you would need to cahnge the query slightly, , and the <select> into that the php outputs, but yeah, the rest would efectivly be the same.
-
for the price thing, either just add the relevent no of 0's into the if condition, or, my preffered way would be to add them onto the string: echo "<option value\"$minPrice\,000">£$minPrice,000</option>"; (makes it easier to get the , in there) I'm guessing from the var_dump that you didn't change over the Property Type so it was the same as the areas element?
-
it was me again, it's var_dump() not vardump()
-
not much benefit to replacing the rest of the form items. That should do it for the index page. So onto the search results page: form is still using action="insert.php" and method="get". change the method to method="POST" and then put the following at the top of insert.php <?php die(vardump($_POST)); //...rest of your code post up what you get back and we'll go through it.
-
take the capital off Locations, so it's all lower case: SELECT id, area_name FROM locations GROUP by area_name
-
$document->formatOutout = true; ? formatOutput maybe?
-
nope, it's in place of the of the html, so: <td><p class="LOC">Location:</p></td> <td><div id="LC"> <?php $locationSql = "SELECT id, area_name FROM Locations GROUP by area_name"; $locQry = mysql_query($locationSql) or die (mysql_error()); echo "<select name=\"areas\" multiple=\"multiple\" size\"=5\" style=\"width:150px;\">"; while ($location = mysql_fetch_assoc($locQry)){ echo "<option value=\"{$location['id']}\">{$location['area_name']}</option>"; } echo "</select>"; ?> </div>
-
your form action should still point to where it always did, you're not posting the form to the mstr_ref.php, it's just a file that we are going to reqire_once on each page (and as PHP code as all parsed befor the page reaches the browser, it doesn't really matter where on the page it goes (normaly, there are some exceptions). mstr_ref.php holds the info in it that is of common use, such as database connection. You put that code in the index.php file, to replace the html code that is making the current <select name="areas">. None of the code is going off page yet, so clicking the submit button isn't going to do anything new (at least it shouldn't) We still want to have the form point to the page that will be displaying the results. so just now you should have 3 pages : index.php has a form that links to insert.php and mstr_ref.php that is currently used in index.php vie a require_once call. the form still points -> to insert.php, but as we havn't looked at that page yet, there isn't anything much going to happen when you submit the form. although I on't think that's really the best name for the page that we want the form to go to as we're not doing anthing that reales to "insert", so once we have the index page sorted out well look at making a new page calling it results.php
-
No problem, glad it worked for you.
-
then the most likely probem is your hosing isn't configured to parse .inc files as php files. change the extension to . php and see what happens.
-
Just pop over to http://www.apachefriends.org/en/xampp.html and pick the windows distro from the list, For standard use the isn't much you need to do, run the exe, pick the install path, choose anything you want to run as a windows service, wait for the green bar and hay presto, job done. enable the MySQL and Apache servers from the control app (or restart if you picked service installs) and that's it you can now navigate to http://localhost and you will find phpmyadmin on http://localhost/phpmyadmin. XAMPP installs MySQL with no password for the root account by default, so that will need to be one of your prioritys. For more info on install/setup and use you can see this post http://dalibor.dvorski.net/downloads/docs/InstallingConfiguringDevelopingWithXAMPP.pdf which is available in the documentation section of the apachefriends wbsite.
-
ok, let's see the code you have now as well as any error messages.
-
your problem seems to be specific to the environment that you are running it on, coveriing all the options could take days to go through. First thing to check is the logs folders for both apachie and mysql and see if you can get any specific information from them, if there is anything usefull post it up and someone will have a look through. And to be fair, I have done about 20 installs of XAMPP on windows systems across xp, vista, 7, 2003svr and 2008svr and never once had the slightest problem. Up and running with full functionality in under 3 minutes normally.
-
case matters - it's $_SESSION not $_session
-
How to Embed a Photo Gallery from Picasa / Flickr / etc.
Muddy_Funster replied to biggupp's topic in PHP Coding Help
you could try nesting another for each inside it: foreach ($ph_sets as $ph_set){ if ($ph_set == 'AHY'){ foreach($ph_set as $set_ahy){ //change all the refferences from $ph_set to $set_ahy -
is there a reason your not using XAMPP?
-
ok, give this a shot: <?php //signin.php include 'connect.php'; include 'header.php'; echo '<h3>Sign in</h3><br />'; //first, check if the user is already signed in. If that is the case, there is no need to display this page if(isset($_SESSION['signed_in']) && $_SESSION['signed_in'] == true) { echo 'You are already signed in, you can <a href="signout.php">sign out</a> if you want.'; } else { if($_SERVER['REQUEST_METHOD'] != 'POST') { /*the form hasn't been posted yet, display it note that the action="" will cause the form to post to the same page it is on */ echo '<form method="post" action=""> Username: <input type="text" name="username" /><br /> Password: <input type="password" name="password"><br /> <input type="submit" value="Sign in" /> </form>'; } else { /* so, the form has been posted, we'll process the data in three steps: 1. Check the data 2. Let the user refill the wrong fields (if necessary) 3. Varify if the data is correct and return the correct response */ $errors = array(); /* declare the array for later use */ if(!isset($_POST['username'])) { $errors[] = 'The username field must not be empty.'; } if(!isset($_POST['password'])) { $errors[] = 'The password field must not be empty.'; } if(!empty($errors)) /*check for an empty array, if there are errors, they're in this array (note the ! operator)*/ { echo 'Uh-oh.. a couple of fields are not filled in correctly..<br /><br />'; echo '<ul>'; foreach($errors as $key => $value) /* walk through the array so all the errors get displayed */ { echo '<li>' . $value . '</li>'; /* this generates a nice error list */ } echo '</ul>'; } else { //the form has been posted without errors, so save it //notice the use of mysql_real_escape_string, keep everything safe! //also notice the md5 function which hashes the password $uname = mysql_real_escape_string(trim($_POST['username'])); $upass = mysql_real_escape_string(trim($_POST['password'])); $encPass = md5($upass); $sql = "SELECT userid, username, userlevel FROM users WHERE username = '$uname' AND password = '$encPass'"; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'Something went wrong while signing in. Please try again later.'; //echo mysql_error(); //debugging purposes, uncomment when needed } else { //the query was successfully executed, there are 2 possibilities //1. the query returned data, the user can be signed in //2. the query returned an empty result set, the credentials were wrong if(mysql_num_rows($result) == 0) { echo 'You have supplied a wrong user/password combination. Please try again.'; } else { //set the $_SESSION['signed_in'] variable to TRUE $_SESSION['signed_in'] = true; //we also put the user_id and user_name values in the $_SESSION, so we can use it at various pages while($row = mysql_fetch_assoc($result)) { $_SESSION['userid'] = $row['userid']; $_SESSION['username'] = $row['username']; $_SESSION['userlevel'] = $row['userlevel']; } echo 'Welcome, ' . $_SESSION['username'] . '. <br /><a href="index.php">Proceed to the forum overview</a>.'; } } } } } include 'footer.php'; ?>
-
Session Variable and 'foreach' Problem
Muddy_Funster replied to hobbiton73's topic in PHP Coding Help
don't know that application, and I'm not sure what or where your looking to use the $_SESSION variables within the foreach. I will say that $_SSESSION variables have a global scope so you can use them directly anywhere in your code. Sorry I can't help more than that, hopefully someone else will be better able to help. -
you say it's in md5, but your original code has it in sha1 : password = '" . sha1($_POST['password']) . "'"; have you tried changing that to md5? or is it actualy in sha1?