-
Posts
14,894 -
Joined
-
Last visited
-
Days Won
176
Content Type
Profiles
Forums
Events
Everything posted by Ingolme
-
That article is OK for learning basics but there are things that aren't right. First of all, they mentioned "Netscape" which means this is a very old article. The second problem is that they're using register_globals instead of the $_GET array to access input variables.Another problem is that they're not sanitizing data before putting it into a query, which means that visitors to your site can mess up the database.
-
For the printf() function, specifically, the list of all the % placeholders is in the sprintf() manual page.
-
It's a complex system. It involves HTML forms and PHP. You can always choose your own variables names, or even just pass literal values to the function. printf($a, $;printf($x, $y);printf('Literal %s', 'string');$s = 'string';printf('Variable and literal %ss', $s);
-
print can output as many variables as you want. A good use for printf() is outputting content in different languages.Here's an example: <?php$num = 5; if($language == 'english') { $format = 'There are %d monkeys.';}if($language == 'spanish') { $format = 'Hay %d monos.';} printf($format, $num);?> This example isn't perfect because it can be done without printf(), but I'm building a system that supports multiple languages which uses the sprintf() function.
-
The first argument of the printf() function has a string with special codes where variables are supposed to go. (%s, %d ... and others) The variables from the rest of the function arguments are put in the string where the codes are. The sprintf() page has more information on what each code is for:http://es.php.net/manual/en/function.sprintf.php Here's an example copied from the manual <?php$num = 5;$location = 'tree';$format = 'There are %d monkeys in the %s';printf($format, $num, $location);?>
-
I don't like creating extra elements for styling if I can avoid it. You can make a 1x1 pixel semi-transparent PNG as a background image if you want to support browsers that don't accept rgba format.
-
You can add events to elements without actually changing the HTML of the element. CSS cannot do what you're asking for.
-
CSS just makes rectangles.The only way to work with other shapes is image maps and the <canvas> element with Javascript.
-
It can be done, but not with CSS. You would need to use Javascript. Just attach an onclick event to the box and set the height.
-
channeling mult links to a single Solved with thanks in final post
Ingolme replied to niche's topic in JavaScript
I'd keep the href attribute in case Javascript is disabled, then return false to prevent the link from opening a new page. -
You can use mysql_error() to see what the problem is. I think the problem is that you have a comma at the end of this line: maidenname varchar(255) NULL,
-
I'm not the one choosing the language. The PHP manual chooses the language automatically when you get there. I always use echo because print has no advantages over it.
-
channeling mult links to a single Solved with thanks in final post
Ingolme replied to niche's topic in JavaScript
You can have a query string on the link so that PHP knows which page to go to: <a href="direct_all_links_from_here.php?page=Bob">Bob</a><a href="direct_all_links_from_here.php?page=Barbara">Barbara</a><a href="direct_all_links_from_here.php?page=Beatrice">Beatrice</a> -
The difference between echo and print() is that print() can be used anywhere that a function can while echo cannot. Another difference is that echo can have several parameters separated by commas.Function behavior from print() $a = print('Something');echo $a; // outputs "1" Echo can take several parameters echo 'A', 'B', 'C', 'D'; For more information, read the manual pages for echo and print:http://php.net/echohttp://php.net/print
-
channeling mult links to a single Solved with thanks in final post
Ingolme replied to niche's topic in JavaScript
If the link has an href attribute, just send all the links to one function that gets the href property from the link. -
Getting Rid of localhost and Domain Name in href Path
Ingolme replied to OtagoHarbour's topic in PHP
Just prepend http:// to the URL. <a href="http://192.168.1.4/about.php">About</a> -
If you could show a working example of the problem then I could see the problem.
-
You can put the PHP between other HTML, like this:<!DOCTYPE html><html> <head> <title>Page</title> </head> <body> <h1>Database test</h1> <?php // Database code goes here ?> </body></html>
-
It might be due to case sensitivity. Check that your element's ID is "leftCol" and not "leftcol" or something else. Also, be sure the element has an "id" attribute and not a "name" attribute. The DOCTYPE only breaks the page if something was wrong in it to begin with.
-
Check that you're uploading the files to the www/ or htdocs/ or public_html/ folder.
-
You should have the session_start() at the very beginning of your script. The problem here is the location header. You should use session_write_close() before sending location headers. Another thing is that the location header requires an absolute URL. While some browsers accept relative URLs it is incorrect. session_write_close();header ('Location : http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . '/dow.php'); Be sure to check that $_SESSION['logged_in'] is true on the dow.php file.
-
In the page that's inside the frame you can set the max-height and max-width properties of the image to 600px.. This, requires that the image is inside an HTML page.Instead of an iframe it might be good to try other methods such as Javascript and fall back to PHP.