Jump to content

harristweed

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by harristweed

  1. try <?php echo "Welcome to our Web site, $_POST['name']!" ; ?>
  2. Why do you need a separate table for the picture? I don't think you need a table for single pictures at all. Just rename the image file to match the user unique number. i.e. If user id =123, rename my_picture.jpg to user_123.jpg. Simple?
  3. Post can only be sent from forms. The easiest way to get your pagination working is to append the username to the url. Change the form to GET and add the username to the page links... <form action='search.php?find' method='get'> then echo "<a href='{$_SERVER['PHP_SELF']}?start=$prev&username=$_GET['username']'>Prev</a> "; etc.
  4. $db = mysql_connect("localhost", "MYUSERNAME", "MYPASSWORD"); mysql_select_db("MYDATABASE",$db); $query="SELECT * FROM MYTABLENAME"; $result=mysql_query($query); $header="firstname\t lastname\t emailaddress\t crew_name_001\t "; while($row = mysql_fetch_assoc($result)) { if(empty($row[firstname]))$row[firstname]=" "; if(empty($row[lastname]))$row[lastname]=" "; if(empty($row[emailaddress]))$row[emailaddress]=" "; if(empty($row[crew_name_001]))$row[crew_name_001]=" "; $line = ''; $line .= "$row[firstname]\t $row[lastname]\t $row[emailaddress]\t $row[crew_name_001]\t "; $data .= trim($line)."\n"; } $data = str_replace("\r","",$data); if ($data == "") { $data = "\n(0) Records Found!\n"; } header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=filename=".date("d-m-Y")."-export.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; exit;
  5. I think this is what you are looking for: http://www.felgall.com/jstip22a.htm
  6. The username is not set the for the second page, because it is not posted.
  7. are you sure you have a connection to the database?
  8. works for me! http://richardswebs.com/form.html
  9. no errors in this code, post the whole thing!
  10. Because j is now 10 not 11 altered here: ($k = ($i++) + ($j--)
  11. Just for interest, why: <?php echo isset($_POST['name']) ? $_POST['name'] : ''; ?> Why not just: <?php echo $_POST['name']; ?> If $_POST['name'] is not set, nothing will echo?
  12. can you have an image with a .php extension?
  13. Sounds like an encoding issue, have a look at 'mb_detect_encoding' in php manual
  14. Hi To download .xls file just give a link to the php script.
  15. $line .= "$row[a]\t $row[b]\t $row[c]\t $row[d]\t "; Doh! Sorry bit early for me!
  16. I have found attachments a bit of a nightmare! Why not email a link? $header="column name\t column name\t column name\t column name\t column name\t"; $select="select * from table_name where condition "; $export = mysql_query($select); while($row = mysql_fetch_assoc($export)) { if(empty($row[a]))$row[a]=" "; if(empty($row[b]))$row[b]=" "; if(empty($row[c]))$row[c]=" "; if(empty($d[d]))$row[d]=" "; $line = ''; $line .= "$row[first_name]\t $row[surname]\t $row[email]\t $row[phone]\t $lang[$key]\t"; $data .= trim($line)."\n"; } $data = str_replace("\r","",$data); if ($data == "") { $data = "\n(0) Records Found!\n"; } header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=$file_name"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data";
  17. I had an issue with IE not submitting. The problem was caused by <div>'s I had a div covering the submit button. I added a z-index to the div that the button was in and 'hey presto'............
  18. <?php $the_array=array("1","2","3","4","5","6"); $x=3; $first_part=array(); $second_part=array(); foreach ($the_array as $value) { if($value <= $x){ $second_part[]=$value; }else{ $first_part[]=$value; } $sorted_array=array_merge($first_part, $second_part); } foreach ($sorted_array as $value) { echo"$value<br />\n"; } ?>
  19. I would guess that the problem is the ` change to straight ones!
  20. goto less; Will give an error, so will less: You were also missing some braces <?php for ($count = 0; $count < 10; $count++) { $randomNumber = rand(1,50); if ($randomNumber < 10){ //goto less; }else{ echo "Number greater than 10: $randomNumber<br />"; } //less: echo "Number less than 10: $randomNumber<br />"; } ?>
  21. Oh? They don't then? Isn't your solution what I said two days ago?
  22. //SQL Query of Questions $image_displayed=0; //For Loop { // Output Data // SQL Query Of Possible Answers if($image_displayed==0){ [i]Output answer image here[/i] $image_display++; } For Loop { Output Data } }
  23. Use addslashes and stripslashes on the text and mysql_real_escape_string on the field key? http://es2.php.net/manual/en/function.mysql-real-escape-string.php
  24. To accept cards yourself you need a card holder not present merchant account from your bank. If you get one of those i'll be amazed. Stick with Paypal!
×
×
  • 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.