harristweed
Members-
Posts
346 -
Joined
-
Last visited
-
Days Won
1
Everything posted by harristweed
-
Very simple Form using PHP not working, please help.
harristweed replied to jhodara's topic in PHP Coding Help
try <?php echo "Welcome to our Web site, $_POST['name']!" ; ?> -
associating photo upload with previously submitted form data
harristweed replied to webguync's topic in PHP Coding Help
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? -
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.
-
MYSQL to excel....exporting only one column
harristweed replied to davidcriniti's topic in PHP Coding Help
$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; -
Nested Loop for "Cities in Regions" Menu by State
harristweed replied to Dizzle's topic in PHP Coding Help
I think this is what you are looking for: http://www.felgall.com/jstip22a.htm -
The username is not set the for the second page, because it is not posted.
-
are you sure you have a connection to the database?
-
works for me! http://richardswebs.com/form.html
-
no errors in this code, post the whole thing!
-
Because j is now 10 not 11 altered here: ($k = ($i++) + ($j--)
-
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?
-
can you have an image with a .php extension?
-
Question about how to track and display time correctly
harristweed replied to JeremyCanada26's topic in PHP Coding Help
Why not use GMT? -
Sounds like an encoding issue, have a look at 'mb_detect_encoding' in php manual
-
Hi To download .xls file just give a link to the php script.
-
$line .= "$row[a]\t $row[b]\t $row[c]\t $row[d]\t "; Doh! Sorry bit early for me!
-
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";
-
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'............
-
<?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"; } ?>
-
I would guess that the problem is the ` change to straight ones!
-
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 />"; } ?>
-
Oh? They don't then? Isn't your solution what I said two days ago?
-
//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 } }
-
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
-
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!