HuggieBear
-
Posts
1,899 -
Joined
-
Last visited
Posts posted by HuggieBear
-
-
I assume you mean a line break, not a page break.
Try changing these lines:
$tmp[] = "</ACCOUNT_NO>"; $tmp[] = "</ACCOUNT_NAME>";
to these:
$tmp[] = "</ACCOUNT_NO>\n"; $tmp[] = "</ACCOUNT_NAME>\n";
-
A good free pdf generator is fpdf
There's also a Pear package for it
-
Make sure your form has a username and password field and then use something like this:
<?php session_start(); if (!isset($_SESSION['logged_in'])){ // You're not logged in, have you submitted the form if (isset($_POST['Submit']) { // You have submitted the form if ($_POST['username'] == 'admin' && $_POST['password'] == 'xyz'){ // You're authenticated $_SESSION['logged_in'] = $_POST['username']; echo "Thanks for logging in"; } else { // You entered invalid details echo "Sorry, the username and password you entered are invalid"; } } } else { // You're already logged in echo "You're logged in as " . $_SESSION['logged_in']; } if (!isset($_SESSION['logged_in'])){ // Display the form echo "This is where your form code goes"; } ?>
-
That's not doing the same thing, it's setting an environment variable.
-
No, your version is too old.
From the manual:
date_default_timezone_set (PHP 5 >= 5.1.0) -
Have you tried curly braces?
$sub = $sub->{zip code}
This doesn't seem right, do you have the code for us to look at?
-
Can you edit the structure of the original text file?
Is there an answer to this?
-
Your HTML form doesn't contain a field called username then.
-
If you have no standard data structure within your text file it's going to be difficult I think. Can you edit the structure of the original text file?
-
Happy to help. Just glad that you're giving it a go and learning yourself rather than asking people to do it for you.
-
They should be in double quotes "\n\n"
$message = "Someone just filled out the online order form! Here's their info:\n\n";
-
Fixed that too. Now Im getting this error:
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /mounted-storage/home7/sub007/sc30390-PTUD/***********.com/form2.php on line 31
Why do you think that is? Look at what I asked you to change (Connection variable name!)
-
That means that your database connection failed, or you're specifying the wrong connection handle. In your case it's the latter.
Change:
mysql_query($sql,$con)
To:
mysql_query($query,$connection)
As those are the variable names you've used earlier in your script.
-
The error would help.
-
Thanks Kira, I didn't know that. Is it standards compliant?
-
Can you tell me how to add a return? or <br>?
Run the message contents through nl2br() if it's an HTML email, if not then just add a \n.
-
Nope, that's a browser preference and can only changed on the client side I believe.
Try googling for terms like 'Prevent Auto Complete'
-
The above post probably isn't what you want.
Do you want the file saved on the server or the client?
-
If you're checking two variables, make sure it comes before you check one.
e.g.
if ($direction == 'north'){ echo 'Direction is North'; } elseif (($direction == 'north') && ($distance == '1')){ echo 'Direction is North, Distance is 1'; }
The second condition will never be met as the first is less specific. Put the most specific conditions first, like this:
if (($direction == 'north') && ($distance == '1')){ echo 'Direction is North, Distance is 1'; } elseif ($direction == 'north'){ echo 'Direction is North'; }
-
Yeah, that's possible. You should put more specific rules first though.
-
I'm trying to figure out if today's current date and time falls between Mon & Fri
This doesn't make sense. If you're trying to find out if today's date falls on a week day, what does the time matter?
$weekend = array('Sat','Sun'); $today = date('D'); if (!in_array($today, $weekend)){ echo 'Yup'; } else { echo 'Nope'; }
-
You're using $data in your for loop, but not setting it anywhere. Do you meant to use $res?
-
OK, what separates the chapter from the author and the author from the content?
-
Is the data in the text file delimited in anyway e.g. colon?
1:J.K. Rowling:"Well, I had one that I was playing Quidditch the other night," said Ron, screwing up his face in an effort to remember. "What do you think that means?". "Probably that you're going to be eaten by a giant marshmallow or something," said Harry, turning the pages of The Dream Oracle without interest.
Writing output to a file
in PHP Coding Help
Posted
Can you post your most recent code now.