Jump to content

insidus

Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by insidus

  1. This might not an elegant solution.. But you could send the form to mail.php and send the mail, thenuse CURL to send the information to PayPal. http://stackoverflow.com/questions/3080146/post-data-to-url-php
  2. I think instead of \n its \r\n. You could always print them inside <pre> tags, or use var_dump(), which will print the information + a little more on separate lines. edit. or simply use <br /> tags
  3. Not a problem, glad I could help Can you set this thread as 'answered'? /Insidus
  4. The first thing you should do before the if(isset($_POST['posted'])) ​Is add this line var_dump($_POST['posted']);
  5. Cookies can be a pain when debugging. Cookies that are set on a PHP page, at the start, end or middle cannot be used in that 'load' of the page, to get the client to send cookie data to the server to be processed you will have to do a page reload. Once a cookie has been set in your browser, you either need to create a PHP script to destroy the Cookie, setcookie("user", "Alex Porter", time()-3600); - "time()-3600", or delete the browsers cookie/session data. If you wanted to set a cookie, and use its data straight away, you should either use the variable that you used to set the cookie in the first place within the rest of your code. Set the cookie, for a page reload with header('location: page location'). Or set the data into a session aswell and call that instead. Hope that helps a little. /Insidus
  6. Your not far off! have alook at this and try to figure it out. $totalPrice = 0; echo "<table border='1'> <tr> <th>Product</th> <th>Quantity</th> <th>Price (£)</th> </tr>"; while($column = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $column['Product'] . "</td>"; echo "<td>" . $column['Quantity'] . "</td>"; echo "<td>" . $column['Price'] . "</td>"; echo "</tr>"; $totalPrice += $column['Price']; } echo "</table>"; echo $totalPrice; Start by initiating a variable to hold the total price before the while loop. Inside the while loop, after you print the table row, increment the total price by column['price']. Once outside the while loop, echo the total price out. $totalPrice += $column['Price'] is the same as $totalPrice = $totalPrice + $column['Price'];
  7. So for my website, i have a folder structure of /styles/ /js/ /includes/ etc. if i navigate to those folder locations in the url, it shows a file/directly listing of whats inside. Is there a way of throwing a 404 error if they are accessed? or do i have to do it by using a index.php file? /insidus
  8. Is the PHP version the same as your previous host?
  9. That works if your funding a percent off 100. But say if you wanted 40 percent of 60. 60/40 = 1.5. But I'd you get 1% first by 60/100 = 0.6, then * 40 = 24. By working out 1%, you can times it to find any percentage
  10. Try logging in with the user you in phpmyadmin, then run a simple query on the database, if that succedes then it is the script.
  11. The user doesn't exists in MySql, if you have Phpmyadmin installed, go to Privileges and make sure the user 'user_name' actually exists, has the CORRECT password, and have access to the database your trying to query. the error is Access denied for user 'user_name'@'localhost', which means you have an error with the user trying to connect.. either it doesn't exists, or the credentials are wrong. /insidus
  12. to get 1% of a number, in a normal maths sum, you would do Number / 100 this gives you 1%, then * 10 for 10%, or *50 for 50%. so you would do $percent = 10; $commission = (($row['price'] /100) * $percent); echo "You get: " . $commission . " (10%)";
  13. Turns out, i needed to include -MultiViews in the .htaccess file to get that bit working, but now for my production site, if i do RewriteRule ^view_job/([0-9]+)$ ./view_job.php?job_id=$1 [L] It loads the page, with the correct 'job', but it doesnt load the CSS file? surely its not needed to make a rewrite to the css aswell?
  14. The % in most programming languages isn't a percentage, instead, its modulus/remainder $a % $b Modulus Remainder of $a divided by $b. So to work out percentage, its what the OP said
  15. http://insidus.co.uk/pretty/?id=2 Works, so it seems to be with the GET statement maybe?
  16. RewriteRule ^pretty/([0-9])$ pretty?id=$1 [L] still didn't work im afraid http://insidus.co.uk/pretty.php?id=2 http://insidus.co.uk/pretty/2
  17. Im trying to get my head around pretty URLs, but i just can't seem to grasp it. .htaccess Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^pretty/([0-9])$ pretty?id=$1 [L] pretty.php <?php echo $_GET['id']; ?> <h1>hi</h1> if i go to http://.....co.uk/pretty it prints "Hi" and an error cause the GET isn't set, it does the same if i go to .co.uk/pretty/2 How does one use pretty urls within a site? i ready hundreds of sites/tutorials on this, and nothing says how you GET the data from the url .co.uk/pretty.php?id=2 works
  18. while($row = mysql_fetch_array($correctHash)) { echo $row['password']; }
  19. check to see if the line is not Empty. If its not empty check to see if its not a comment (AND) has to be both not empty and not a comment check to see if the line is not empty. regardless of if it is or not, check to see if its a comment (OR) doesn't matter if its a comment or not empty You only want to process lines that are not empty and that are not a comment, so you would use AND If you want to find all lines that WERE empty, OR WERE a comment, then use OR
  20. Don't forget that with OR.. if the first value is true, then it won't bother processing the rest of the conditions.. cause one is true, so the OR passes.. With AND, if the first value is false, it won't process the rest of the condition Doing if(isset($_GET['id']) && $_GET['id'] != "") won't throw and error if then ET value hasn't been sent.. usally, the last condition would throw and error cause $_GET['id'] isn't set, so it cant check it, but the because the isset() failed, it didn't check the value of the GET
  21. This would be done with using AJAX.. HTML Form <div> <select id="select"> <option value="1">Hello</option> <option value="1">Goodbye</option> </select> </div> <div id="ajax"> </div> jQuery $(document).ready(function() { $("#select").change(function(){ var d = $("#select:option selected").text(); //.var .html <- can't remember which function alert(d) // make sure you got the right value $.ajax({ type: "POST", url: ajax.php, data: "load=" + d, success: function(html){ $("#ajax").html(html); // where to out the data }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert("Error jQuery - Ajax - 1"); } }); }); }); ajax.php <?php $select = $_POST['load']; // do stuff here echo $select // this goes into the #ajax div in index.php
  22. How do you mean two divs in a time period? and image changing? like a slider? or change image on hover?
  23. trim($l) != ' ' Shouldn't that be trim($l) != '' ' ' is a space, and '' is the same as empty() And shouldn't you be using AND? If LINE Isnt Empty AND Isnt a Comment... do this not If LINE Isnt Empty.. OR If Line Isnt a comment Use && not ||
  24. You should also write exit; As exit();
  25. The problem you're having is because the simplexml_load_file is treated almost like a class, instead of a variable. this page will help you http://www.w3schools.com/php/php_xml_simplexml.asp try doing print_r($xml->getName());
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.