denno020
Members-
Posts
761 -
Joined
-
Last visited
-
Days Won
3
Everything posted by denno020
-
If and else Statements -- Complete newbe, Please Help
denno020 replied to Marcus2000's topic in PHP Coding Help
Should also add that for each time you check $_POST, you need to use square brackets, not the rounded ones.. Sorry man Denno -
If and else Statements -- Complete newbe, Please Help
denno020 replied to Marcus2000's topic in PHP Coding Help
Alright, I think I've fixed it for you.. I'm a douche bag. Such a simple error... if(isset ($_POST["download"])) Note the square brackets instead of the curly.. Try that. Denno -
If and else Statements -- Complete newbe, Please Help
denno020 replied to Marcus2000's topic in PHP Coding Help
You need to change the if isset to have download in the double quotes, or c. I'm not sure exactly which one, but having submit in there does nothing. The reason I used submit is because it's commonly used as the name for the submit button, you've used download. Denno -
If and else Statements -- Complete newbe, Please Help
denno020 replied to Marcus2000's topic in PHP Coding Help
Can I please see your form html code? -
If and else Statements -- Complete newbe, Please Help
denno020 replied to Marcus2000's topic in PHP Coding Help
Try with double quotes instead of single.. Not sure if it would make much difference, but worth a try. Denno -
In the Look and Feel section of Account Settings, I had selected to Show WYSIWIG Editor by Default, not really knowing what it did. It turns out though that using this option inside of Chrome caused quite a few issues. When trying to insert php tags using the button above, it would put them the wrong way around (closing first, then opening). Also, when posting, it would add in extra things like font, size and colour information into the code, which I never put there. Just thought I would let you guys know so you could have a look at it yourself. Denno
-
If and else Statements -- Complete newbe, Please Help
denno020 replied to Marcus2000's topic in PHP Coding Help
as lalnfl has corrected me, use the format header('Location: http://www.example.com/'); Denno -
If and else Statements -- Complete newbe, Please Help
denno020 replied to Marcus2000's topic in PHP Coding Help
Thanks. I was going straight from memory and I'm a bit of a novice myself, so couldn't remember exactly how it should have gone. Do you have to specify the full http link?? Denno -
If and else Statements -- Complete newbe, Please Help
denno020 replied to Marcus2000's topic in PHP Coding Help
Here is some code that you can use to check for a 'hard coded' password, however you'd almost never use this in a real life situation, instead you would connect to a database and check the password against a stored one. $rightPass = lucky; //if a form has been submitted - otherwords, the user has submitted the password if(isset ($_POST("submit"))){ if($_POST("password") == $rightPass){ //user has entered the correct password. //either give them a hyperlink to the next page, or do this: header("next_page.php"): }else{ //user has entered and incorrect password echo "You have entered and incorrect password"; } Hope that helps Denno -
Shouldn't you be passing the database connection to mysql_query() aswell? But I guess if you're getting the information from the database without it, then you might not need it :S.
-
Stupid question.. are you checking the junk mail folder of the receiving inbox? Also, is there a reason why you're using the output buffering as opposed to just appending strings to a variable? Denno
-
You'll most likely have to use ajax to get the status of the shopping cart. Or, you could use php to check if there are any items in the cart, and if there is, echo the javascript code for the alert, otherwise, don't echo it, so therefore it won't run. If that makes sense? Denno
-
help with undifined functions I JUST DON'T NO
denno020 replied to jeppers's topic in PHP Coding Help
What is the error that you're given and on which line.. Denno -
I don't see a problem. Nothing seems out of place in my firefox? Denno
-
including sql results within this email? whats going on !?!?
denno020 replied to wright67uk's topic in PHP Coding Help
$code = $_GET['postcode']; $message = $_GET['message']; $shortcode = substr($code,0,2); $subject = "subject here"; $headers = 'From: me@me.com' . "\r\n" . 'Reply-To: me@me.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3") or die (mysql_error()); while ($array = mysql_fetch_array($result)) { $email = $array['email']; $to = $email; $message .= 'Message is being sent to: ' . $email; echo nl2br ($message); mail( "$to", "$subject","$message", "$headers"); } echo "<h2>Business Names:</h2>"; echo "<br>" . "Thank you for using our mail form."; That's the sort of thing I would do. So the while loop that goes through the result set from the query will send the mail out. This way there will only be 1 email address in the 'To' field, and the address it's being sent to can easily be added to the message. What are you trying to achieve though? Where should the 'one on each line' email addresses be displayed? Should this be on the confirmation page or should this be in each email itself? If it's the former, then you could simply add each email address to a new variable inside the while loop as such: //before the while loop $sentTo = ''; //inside the while loop $sentTo .= $email . '<br/>'; //at the place you want it to be displayed on the confirmation page echo $sentTo; Hope that helps . Denno -
including sql results within this email? whats going on !?!?
denno020 replied to wright67uk's topic in PHP Coding Help
Why don't you change your script so that it sends an email to one person at a time? Which means that when the person receives the email, it'll only have their email address in the to field. This would then make it heaps easy to send the same email to multiple people with specific information (like the person's email address), inside the email... I've been playing with some code and I've got something that will work, so let me know if you want it. Denno -
You need the closing double quote on the line: $qryUsers = "SELECT * from recipies WHERE user='".$_SESSION['username']."'" AND Rid=".$_REQUEST['Rid']"; which is....... on line 100! Amazing. Denno
-
Yeah I know, my editor has been acting weird. When I click on the php code button, it places them the wrong way round too! lol, It closes, then opens :S.
-
$sqlCommand = "SELECT * FROM productfeed LIMIT 10;" $query = mysql_query($sqlCommand, $myConnection) or die(mysql_error()); while($row = mysql_fetch_array($query)){ $id = $row['ID']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; echo "<div class=\"productdisplayshell\"> <div class=\"productdisplayoutline\"> <div class=\"productborder\"><center> <a href=\"$link\" target=\"_blank\" ><img src=\"$image\" /></a> </center> <><> <div class=\"productdescriptionoutline\"><div class=\"productdescriptionbox\"> <a href=\"$link\" target=\"_blank\" >$description</a> <><div class=\"productfulldescriptionbox\"> $fulldescription <><> <div class=\"productpriceoutline\"> <div class=\"productpricebox\"><center>£ $price</center><> <div class=\"productbuybutton\"><center><a href=\"$link\" target=\"_blank\" ><img src=/images/buybutton.png /></a></center><><><>" ; } Try that Denno
-
Did some further checking into the multiple displaying of images, and you can achieve the sme result with just 4 lines of code.. Try this: $directory = './images'; foreach(glob("$directory/*.jpg") as $filename){ //echo '<option value='.$dir.'>'.$dir.'</option><br>' . "\n"; echo '<img src="' . $filename . '"/><br />' . "\n"; } Exact same result. I have commented out the option tags as I'm not sure what you were aiming for there so I've left that up to you to work out how they should be written . Hope that helps Denno
-
Here ya go mate: function GetImages($map) { $files = glob("$map/*.jpg"); for ($i=0; $i<count($files); $i++) { $num = $files[$i]; echo '<img src="' . $num . '"/><br />'; } } $directory = './images'; if ($handle = opendir($directory)) { /* loop through directory. */ while (false !== ($dir = readdir($handle))) { if($dir != ".." && $dir != "."){ echo '<option value='.$dir.'>'.$dir.'</option><br>' . "\n"; GetImages($directory); } } closedir($handle); } Works a charm , oh except for the doubling and tripling up of images lol Denno
-
I think i've just worked out what's happening. The variable being passed to the GetImages() functions isn't actually a directory, it's passing a filename. So using it in the glob function like this: glod('$map/*.jpg'); Won't actually work.. You need to save the directory into it's own variable, and then pass that variable to both the opendir() function and the glob() function. That doesn't make it work perfectly, however it's close.. Denno
-
I just removed the variable $map from being sent to glob(), and instead put the filepath there and it is now picking up the files, and displaying the code almost as desired. It still requires some tweaking, but the problem seemed to be in the variable being passed to the GetImages() function... Denno
-
Your for loop never runs as count($files) returns 0. I'm not sure why, but I thought I would let you know if you didn't already do you could work something else out. I'm going to keep looking at it myself too as I'm interested to see how it's done. Denno