Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Yakindo

Members
  • Joined

  • Last visited

  1.    Yakindo reacted to a post in a topic: Review my code.
  2. It's a lot simpler than it seems, all you would have to is extend the current $headers variable like so, all we're doing is adding one more line onto the headers variable: $headers = "From: $myemail\n"; $headers .= "Content-type:text/html; charset=UTF-8\n"; $headers .= "Reply-To: $email_address"; $headers .= "\nCC: $email_address"; If you want to add a checkbox; then add the following to your contact form (change it to suit your needs etc): <label for="send_to_user">CC?</label> <input type="checkbox" value="1" name="send_to_user" id="send_to_user" /> Add this to the top of your contact form file, what this code is doing is checking if in the post array there is a key called 'send_to_user'. If the checkbox has not been ticked, this will not be sent over. When type-casted, 1 will return as true and 0 will return false, so it's just a quick check to make sure the value is correct. $sendToUser = array_key_exists('send_to_user', $_POST) && (bool)$_POST['send_to_user']; Then change your $headers variable to look like so, if the checkbox has been selected, we'll just append the cc onto the string: $headers = "From: $myemail\n"; $headers .= "Content-type:text/html; charset=UTF-8\n"; $headers .= "Reply-To: $email_address"; if ($sendToUser) { $headers .= "\nCC: $email_address"; } Your overall file at the end should look something like this: <?php $sendToUser = array_key_exists('send_to_user', $_POST) && (bool)$_POST['send_to_user']; $errors = ''; $myemail = 'EMAIL@EMAIL.COM'; if (empty($_POST['contactname']) || empty($_POST['email']) || empty($_POST['message']) ) { $errors .= "\n Error: all fields are required"; } $name = $_POST['contactname']; $email_address = $_POST['email']; $message = $_POST['message']; if (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i', $email_address)) { $errors .= "\n Error: Invalid email address"; } if (empty($errors)) { $to = $myemail; $email_subject = "You have a new message"; $email_body = "(html based email here)"; $headers = "From: $myemail\n"; $headers .= "Content-type:text/html; charset=UTF-8\n"; $headers .= "Reply-To: $email_address"; if ($sendToUser) { $headers .= "\nCC: $email_address"; } mail($to, $email_subject, $email_body, $headers); //redirect to the 'thank you' page header('Location: /thanks/'); } ?> <!doctype html> <html> <head> <title>Contact form handler</title> </head> <body> <!-- This page is displayed only if there is some error --> <?php echo nl2br($errors); ?> </body> </html>
  3.    Weedy101 reacted to a post in a topic: Reading associative arrays?
  4.    pbb76 reacted to a post in a topic: Reading associative arrays?
  5. Operating System: Linux Ubuntu / Windows 7 (for when access to Fireworks / Photoshop is needed) I have 2 machines I develop on, a laptop which I got back in the day and a PC I built myself. PHPStorm Terminal; (Node, SASS, Git, Grunt) etc Vagrant (create a VM which runs as a server, can customise the setup to different PHP versions, etc) - quite resource hungry, so only used on Desktop XAMPP Fireworks / Photoshop
  6. In answering the title of your thread, the best way I've found to read arrays is using the function print_r();: <?php $array_var = array(); // the var which stores the array ?> <pre><?php print_r($array_var); ?></pre> This will output the array in an easy-to-read format, where all the keys you need to access the array items are defined. For this array: <?php $new_invoice = array( array( "Type"=>"ACCREC", "Contact" => array( "Name" => "Income" ), "Date" => "2013-12-31", "DueDate" => "2013-12-31", "Status" => "DRAFT", "LineAmountTypes" => "Exclusive", "LineItems"=> array( "LineItem" => array( array( "Description" => "Sales - Wet", "Quantity" => "1.0000", "UnitAmount" => "2500.00", "AccountCode" => "200" ), array( "Description" => "Sales - Pool Table", "Quantity" => "1.0000", "UnitAmount" => "325.25", "AccountCode" => "200" ) ) ) ) ); ?> <pre><?php print_r($new_invoice); ?></pre> The following is outputted in the HTML: Array ( [0] => Array ( [Type] => ACCREC [Contact] => Array ( [Name] => Income ) [Date] => 2013-12-31 [DueDate] => 2013-12-31 [Status] => DRAFT [LineAmountTypes] => Exclusive [LineItems] => Array ( [LineItem] => Array ( [0] => Array ( [Description] => Sales - Wet [Quantity] => 1.0000 [UnitAmount] => 2500.00 [AccountCode] => 200 ) [1] => Array ( [Description] => Sales - Pool Table [Quantity] => 1.0000 [UnitAmount] => 325.25 [AccountCode] => 200 ) ) ) ) ) As you can see all of your information is stored in the 0 array key: $new_invoice[0] Instead of: $new_invoice So to access your description you will need to do the following: $new_invoice[0]['LineItems']['LineItem'][0]['Description']; // first line item $new_invoice[0]['LineItems']['LineItem'][1]['Description']; // second line item To add new items into your "LineItem" key, use the following code: $new_invoice[0]['LineItems']['LineItem'][] = array( "Description" => "", "Quantity" => "", "UnitAmount" => "", "AccountCode" => ""); To loop through the "LineItems" section, using a foreach like so would be plausable: <?php foreach($new_invoice[0]['LineItems']['LineItem'] as $lineItem) { $lineItem['Description']; // this is the description of the line item being looped $lineItem['Quantity']; // this is the quantity of the line item being looped $lineItem['UnitAmount']; // so on and so forth $lineItem['AccountCode']; } ?> I hope you've found this useful.
  7. <?php $name = $_POST['name']; $email = $_POST['email']; $number = $_POST['number']; $message = $_POST['message']; $formcontent="From: $name, \n Number: $number, \n Message: $message"; $recipient = ""; $subject = "Contact Form"; $mailheader = "From: $email \r\n"; if( mail($recipient, $subject, $formcontent, $mailheader) ) { header("Location: thankyou.html"); // success } else { // errors } ?> Add some validation checks!
  8.    Yakindo reacted to a post in a topic: Moan, Grumble, Whinge...
  9.    Yakindo reacted to a post in a topic: htmlshiv or modernizr
  10.    Yakindo reacted to a post in a topic: My first JavaScript app
  11. Right for that function, all you need to do is pass through the category and the sub id, not an array of data. Just two variables (or pieces of data). <?php function get_item_for_sub($sel_sub, $sel_cat) { $query = "SELECT * FROM stock WHERE position = " . $sel_cat . " AND sub_pos = " . $sel_sub . ""; $item_set = mysql_query($query); confirm_query($item_set); return $item_set; } $idkRandomVar = get_item_for_sub($sel_sub['id'], $sel_cat['id']); ?> Then all you need to do is loop through data which has been returned, I don't know if this is any help, could you provide more code (obviously take out any sensitive information)
  12.    PumpkinHead reacted to a post in a topic: Please Help with WHERE clause
  13.    Yakindo reacted to a post in a topic: What are you working on - Sneak Peek?
  14. If you're going to be building a big website, you want to be testing your queries before you implement them into PHP code. Try testing your query first with MySQL Workbench. It allows you to connect to a DB and test your queries before you put it into code. This is great for getting the exact data you want from your query, reducing load times etc. Where is your function getting these two array items from? $query .= " WHERE position = {$sel_catergorie['Id']} "; $query .= " AND sub_pos = {$sel_sub['Id']}"; Also, concatenating your variables being used in the query like so: $query = "SELECT * FROM stock WHERE position = " . $sel_catergorie['Id'] . " AND sub_pos = " . $sel_sub['Id'] . ""; Have you got the spelling correct of your variables etc?
  15.    Yakindo reacted to a post in a topic: Hunt the Wabbit
  16. Line height changes the space between each line of your paragraph, it's used for readability of your content
  17. p { margin: 0 0 15px; /* adds a margin of 15px to the bottom of the paragraph */ line-height: 1.5em /* will increase the line-height of your paragraph */ } In your CSS you need to modify the styling of your <p> tags, I hope this helps! Just realised you're in Dreamweaver, go to code view and at the top of the document, find (I doubt you've got an external stylesheet). <style type="text/css"> /* code here */ </style> Now replace /* code here */ with the previous bit of code I posted.
  18. You're going to have to read up on the Facebook API. (link) Here's someone else with the same issue on StackOverflow. (link)
  19. My advice would be to get MySQL Workbench, it'll allow you to test your queries before you deploy them.
  20. Light, clean designs are my favourite. It really depends on the context of the website.
  21. <p class="institution"> <select name="institution" id="Institution"> <option selected disabled>Please choose your status</option> <option value="Private Client">Private client</option> <option value="Institutional Client">Institutional client</option> </select> You add values to the select options, otherwise the PHP $_POST["institution"] won't contain any information, since there aren't any values
  22. Can you expand on this? easter egg
  23. Self-taught, started when I was around 14 - went to college, left after 6 months because I knew what I wanted to do, be a website developer and there was a web development apprenticeship open, I applied and got it. Got my apprenticeship qualification and now I'm in University, and doing work experience wherever possible. University is just the same as studying on your own, only you get a briefing of assignments to create and pay £9,000 a year... aha. Go for a degree, get work experience and build up your portfolio. That way you're ahead of the majority of website developers who come out of University, because they tend to have no work experience or an online presence from what I've witnessed. Read as many books as possible, as it teaches you a more efficient way of coding, as well as areas of a language that you might find useful, especially O'Reilly books, read up on: Web Designer: UX Design (Anything by Jakob Nielsen) HTML, CSS, Javascript (O'Reilly Books, codeacademy, W3Fools (for the basics) ) Photoshop / Fireworks (clicky) Web Developer: Server-side Programming ( PHP, Ruby, ASP ) ( O'Reilly Books, codeacademy, W3Fools ) HTML, CSS, Javascript (O'Reilly Books, codeacademy, W3Fools (for the basics) ) Don't go straight for learning them all at once, it'll be quite overwhelming. It depends what route you want to go down.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.