Jump to content

joel24

Members
  • Posts

    760
  • Joined

  • Last visited

Everything posted by joel24

  1. have a look at the HTML 2 PDF plugins for fpdf, this way you can write your invoice page in HTML and it will generate a PDF html2pdf and html 2 pdf there are a few more plugins here
  2. why not just run the php backlink checker in the very start of your page, and if a backlink is found then do whatever is then needed (show page etc)... and if one is not found, then echo or include a different page which indicates no backlink was found.
  3. you need to generate the PDF. A good free pdf generator is fpdf
  4. you need to generate the PDF. fpdf is a good free pdf generator
  5. have an IF ISSET declaration to check whether any forms are posted, if not just echo the normal page. i.e. if (isset($_POST['submitButton'])) { //do whatever with the form } else { //form not sent, so echo form to be filled out echo "<form method='POST'> <input name='input1' type='text' /> <input type='submit' name='submitButton' value='Submit Form'/> </form>"; }
  6. Use the get_browser() function. There is a nice user contributed function in the notes (2nd one, by 'ruudrp at live dot nl') To ensure it worked, I would set the IF to show the flash slideshow only in tested browsers which work. i.e. $browser = get_browser(null, true); if ($browser['browser']=='Firefox' || $browser['browser']=='Other working browser') { //echo the flash } else { //echo the simple slideshow }
  7. you'll need some foreach inside of foreach's. something like this should give you the basic idea i.e. $array = array('firstLevel'=>array('2nd level'=>3)); foreach ($array as $value) { if (is_array($value)) { foreach ($value AS $key=>$secondLevel) { echo "key: $key, value: $secondLevel"; } } }
  8. and also, don't use $_REQUEST > use $_POST if its a posted form or $_GET if they're variables sent via the URL. You want $_POST in your case
  9. try this //mail code $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $phone = $_REQUEST['phone'] ; $address = $_REQUEST['address'] ; $pname = $_REQUEST['pname'] ; $pdescription = $_REQUEST['pdescription']; $plow = $_REQUEST['plow'] ; $phigh = $_REQUEST['phigh'] ; $purl = $_REQUEST['purl'] ; $ponline = $_REQUEST['ponline'] ; //default to none uploaded, then overwrite if image uploaded $emailImage = "None Uploaded"; //get picture if($_FILES) { $img = $_FILES['filename']['img']; switch($_FILES['filename']['type']) { case 'image/jpeg' : $ext = 'jpg'; break; case 'image/png' : $ext = 'png'; break; default: $ext = ''; break; } if ($ext) { $n = "image.$ext"; move_uploaded_file($_FILES['filename']['tmp_name'], $n); echo "<span class='uploaded-photo'>uploaded image '$img' as '$n':</span> <br />"; echo "<img src='$n' />"; $emailImage = "<img src='http://{$_SERVER["SERVER_NAME"]}$n' />"; } else echo "'$img' is not a supported image file"; $emailImage = 'Image not of supported types'; } if (!isset($_REQUEST['email'])) { echo "we need your name and email address please" ; } elseif (empty($name)){ echo "please enter your name"; } elseif (empty($email)){ echo "please enter your email address"; } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})", "$email")) { echo"please check your email address - it doesn't appear to be a valid format"; } else { mail( "admin@website.com.au", "subject", "$name\n $email\n $phone\n $address\n $pname\n $pdescription\n $plow\n $phigh\n $purl\n $ponline\n $emailImage\n ", "$email"); header( "Location: ../index.php" ); }
  10. your variable, $n is not set. are the image upload and email scripts two separate scripts? i.e. uploadscript.php and email.php?? you need to put the two together so that the email script can see the variable $n...
  11. just realised I forgot to close the while loop $values=array(); while ($row=mysql_fetch_array($sql)) { $values[]= "<tr> <td>column1: {$row['column1']}</td> <td>value: {$row['value1']}</td></tr>"; } $values=array_reverse($values); foreach ($values AS $row) { echo $row; }
  12. and you want a 1D array of which values?? containing the first level topicname indexes; singapore travels, singapore entertainment... or the 2nd level topicname indexes; airlines, booking, night safari etc
  13. Yes that is whats happening in the code so far, it is working from a page on the server because you're pointing to the image relative to the page, though once you're trying to view it from outside your server you need to add http://www.yourdomain.com/whateverFolders/image.jpg You also need to include the <img> HTML tag //i don't know your domain, so i'm using $_SERVER['server_name'] which returns www.phpfreaks.com if it were run on the php freaks server $image = "<img src='http://{$_SERVER["SERVER_NAME"]}$n' />"; mail( "eamail@address.com", "Subject", "$name\n $email\n $phone\n $address\n $pname\n $pdescription\n $plow\n $phigh\n $purl\n $ponline\n $image\n $img", "$email"); You don't want to overwrite the image, set the image name to have time() at the end of it which is the amount of seconds passed since jan 1 1970... in other words as long as 2 images aren't uploaded in the same second then you won't have any problems. if ($ext) { $n = "image".time().".$ext"; move_uploaded_file($_FILES['filename']['tmp_name'], $n); echo "<span class='uploaded-photo'>uploaded image '$img' as '$n':</span> <br />"; echo "<img src='$n' />"; } else echo "'$img' is not a supported image file"; }
  14. what is the current array? //do this and then post the results print_r($arrayName);
  15. you can't just send an image in an email like that, you must add it as an attachment... or link to a url. In that email you're linking to an image via URL, though the URL is relative to the server upload, not the email... you need the email's image tag to include the full path <img src='http://www.domain.com/images/upload/image.jpg' /> If you want to attach the image, you'll have to read up on some tutorials or use something like php mailer()
  16. there is an example of how to write the back end in the documentation you'll have to look at the example they've given and modify this script to suit your needs.
  17. oh! totally misunderstood what you were after I dare say you'll have to pull those most recent 5 and then use some PHP trickery to order them unless someone more learned in MySQL can help? If you're just echoing a simple table from it, add each row value to an array like $values=array(); while ($row=mysql_fetch_array($sql)) { $values[]= "<tr> <td>column1: {$row['column1']}</td> <td>value: {$row['value1']}</td></tr>"; $values=array_reverse($values); foreach ($values AS $row) { echo $row; } ... though looking at that situation and how convoluted it has become, I dare say someone else could suggest a much simpler way
  18. maybe use some brackets WHERE ($id = all_games.home_team AND all_games.home_goals IS NOT NULL) OR ($id = all_games.away_team AND all_games.home_goals IS NOT NULL) and as for reversing the results, try ORDER BY `date` ASC and see what happens
  19. spot on. you need to give the tables an alias if you're joining to the same table twice INNER JOIN players p1 ON appearances.player = p1.player_id INNER JOIN players p2 ON goals.scorer = p2.player_id
  20. that script is more set for allowing users to FTP upload and then allowing you to execute and copy them all across. there are plenty of upload scripts around, a quick google pulled these 3 ajax/jquery scripts (drag & drop etc) http://valums.com/ajax-upload/ http://www.uploadify.com/ http://plugins.jquery.com/project/file_uploader and here is a single PHP image upload script http://www.reconn.us/content/view/30/51/
  21. change die("Query to show fields from table failed"); to die("Query to show fields from table failed<br/>".mysql_error()); and post any errors it returns
  22. why are you using a variable $id in this line?? the IN clause works like so WHERE column IN ('value1','value2',....) is the first query returning results, though just not ordered correctly, or is it not returning any rows?
  23. have a look at this form tutorial to learn about forms Then you'll have to (as Bradley99 said) set the form's action="search-term.php" and method="POST" Then on search-term.php you can have code such as //assuming the search text input is named 'searchTerm' //check if searchTerm is being posted if (isset($_POST['searchTerm'])) { echo $_POST['searchTerm']; //do whatever else you want if a search term is } You can change the method to GET instead of POST, and the form input will be sent across in the URL such as www.domain.com/search-term.php?searchTerm=bunny rabbit
  24. I would use the .htaccess (URL rewriting) to pull all search terms from the URL (if you're running an apache server), i.e. www.yourdomain.com/search/searchTermHere Here is a tutorial on .htaccess URL rewriting Then use php to generate the page on demand and echo the search term... What are you searching through? Pages in your site, or pages on external sites? Without using a database I think you will be putting a lot of strain on your server unnecessarily...
×
×
  • 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.