Search found 11 matches

by ceiroa
Mon Nov 16, 2009 10:13 am
Forum: PHP - Code
Topic: session_start
Replies: 1
Views: 105

Re: session_start

You need to have session_start() in every page, but if you have it in one file, such as connection.php, that is included in all other files that would be enough (include it at the top). Regarding the last question, you could just assign a value to $username right before the query: $username = $_GET[...
by ceiroa
Tue Nov 10, 2009 1:48 pm
Forum: Miscellaneous
Topic: I need this function to happen when page loads vs OnClick
Replies: 1
Views: 2467

Re: I need this function to happen when page loads vs OnClick

You can register the function with the Window object as an "onload" event handler:  window.onload = fun; You can put that at the top of your javascript code, right before the function definition. Using a library such as JQuery or Dojo would be recommended, as they provide functions that do...
by ceiroa
Tue Nov 10, 2009 10:47 am
Forum: Javascript
Topic: Enable Javascript Dynamically
Replies: 2
Views: 466

Re: Enable Javascript Dynamically

I think the simplest way to do this would be to some PHP code at the top of the page that would read a GET parameter:   $javascriptEnabled = $_GET['jvsEnabled'];   PHP would output the whole HTML page, but would only include the javascript if the link to enable it was clicked, and would include the ...
by ceiroa
Tue Nov 10, 2009 10:25 am
Forum: PHP - Code
Topic: Contact form problems
Replies: 5
Views: 996

Re: Contact form problems

I'm not sure what the problem might be in your case (I work only with linux servers), but the other day I was having a problem with Outlook not reading the "From" header of a PHP-generated email. The emails would end up in the recipient's junk folder. Removing the "To" header sur...
by ceiroa
Tue Nov 10, 2009 10:06 am
Forum: PHP - Code
Topic: downloading files with PHP
Replies: 1
Views: 78

Re: downloading files with PHP

To download a file from a publicly accessible folder (a folder below the web root) you just need to make a link to that file. You can have a static link of a dynamic link built with php. Example of dynamic link: echo '<a href="'.$foldername.'/'.$filename.'">Click to Download</a>"; If ...
by ceiroa
Tue Nov 10, 2009 9:15 am
Forum: PHP - Code
Topic: Contact form problems
Replies: 5
Views: 996

Re: Contact form problems

Well, for starters it seems like many of the variables in the $_POST array were not sent (it might just be that the user, maybe you, did not fill those fields). All those are just Notices, though, so the script would not break because of them. The one that is actually killing it is the Warning at th...
by ceiroa
Fri Oct 09, 2009 10:59 am
Forum: PHP - Code
Topic: Sending an e-mail with an attachment - having trouble...
Replies: 3
Views: 232

Re: Sending an e-mail with an attachment - having trouble...

Steve, The way you construct $emailBody seems fine to me. I think the problem is that all you have as email body should actually be in the headers. You don’t show the line that actually sends the email, but I guess it’s there somewhere, since you say it works but it does not have text in the body. T...
by ceiroa
Fri Oct 09, 2009 10:15 am
Forum: PHP - Code
Topic: displaying mysql data on html form
Replies: 6
Views: 399

Re: displaying mysql data on html form

You are asking too many things at the same time. In order to display the form only at the beginning (before the user submits) start by using the "if" condition that I mentioned:   $username = $_POST[‘user’];   if($username == "") {       echo '<form name="input" action=...
by ceiroa
Fri Oct 09, 2009 10:08 am
Forum: PHP - Code
Topic: PHP or Javascript... can you help me
Replies: 3
Views: 294

Re: PHP or Javascript... can you help me

Why exactly does the link to that page need to contain a referral id? Looks like spam to me...
by ceiroa
Thu Oct 08, 2009 4:58 pm
Forum: PHP - Code
Topic: php OOP Access specifiers - public, protected private etc
Replies: 5
Views: 2843

Re: php OOP Access specifiers - public, protected private etc

Protected methods can be accessed only from inside the same class AND classes that inherit from it. classChild can access a protected method of classParent if classChild extends classParent. The purpose of the private modifier is to hide elements from the outside. A private method will be used only ...
by ceiroa
Thu Oct 08, 2009 4:35 pm
Forum: PHP - Code
Topic: displaying mysql data on html form
Replies: 6
Views: 399

Re: displaying mysql data on html form

There are many ways to do this, but the simplest (although not very scalable) is to have everything in one file. In this case the form’s action tag is set to itself. If the name of the form was testform, you were using POST, and there was only one field in the form (username) it’d look like this: <f...