-
Posts
354 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Irate
-
What's the code for the slideshow? The code you provided above does not really look like it loops through anything.
-
You are ending your document.write too early. document.write("<img src=" /* here your parsing stops the document.write method */ ... Use single quotes for the img src or escape them with a backslash. document.write("<img src=\"...\" ...") || document.write("<img src='...' ...");
-
You should use OOP when you have the same pattern you need to execute multiple times - for example, I recently wrote a class that reads input and a file to produce automated HTML files. MySQLi classes are very handy as you just need to declare mysqli once, for example, $mysqli = new mysqli( string $host, string $user, string $password /*all others are optional */ /*, string $database and some more */ ); You can then use methods of the mysqli class, like $mysqli->query("SELECT * FROM ..."); or $mysqli->real_escape_string($_POST['query']);, you name it.
-
\n is used for plaintext. Since PHP again does not support <br> and \n isn't written directly into the browser (even though <br>s are recognized by JavaScript as \n), you can use string nl2br( string $string ) to give out a proper HTML-formated string.
-
How do I put my PHP variable in between single quote marks?
Irate replied to Jenksuy's topic in PHP Coding Help
echo "<img src='".$file."' onclick='fakeClick(event, document.getElementById(\"".$file."\")"; That should do the job, simply mask all output with backslashes. Edit: You need to use differing apostrophes if you are using strings within attributes. Edited my post above a bit. -
SimpleXML parses XML documents into PHP-readable files out of which you can create RSS feeds.
-
Maybe he hasn't got the MySQLi module installed... which would be strange since it's gotten quite a standard, no?
-
Portability IS the key problem, AbraCadaver, mainly because systems that do not support shortcut tags meaning any code within such tags is directly sent to the client without any previous formating or parsing which is critical.
-
Finding the accurate zip code based on IP Address
Irate replied to junejune's topic in Third Party Scripts
Use a script to calculate the geolocation (ipgetinfo is helpful), something among the lines of <?php function geo() { $ip = $_SERVER['REMOTE_ADDR']; $url = 'http://www.ipgetinfo.com/index.php?ip='.$ip.''; $gc = fopen($url, "r"); $doc = new DOMDocument(); $fc = stream_get_contents($gc); $doc->load($gc); $doc->getElementsByClassName('...'); ... } ?>. The script isn't completed yet, as I cannot get on a PC anytime soon, I have to cancel the script early, write a script that calculates the zip out of the geolocation data ipgetinfo provides. Hope this helped.- 4 replies
-
- zip code
- geolocation
-
(and 1 more)
Tagged with:
-
Use $_POST['answer'] and set <form action="profit_calc.php" method="POST">
-
how to add or activate generator/launcher in HTML with table?
Irate replied to mostone's topic in Javascript Help
Once more, either post what you have or don't bother trying to copy a code that's been declared private by the creator. -
how to add or activate generator/launcher in HTML with table?
Irate replied to mostone's topic in Javascript Help
We're not giving out that code, learn about jQuery yourself or at least post what you have so far. -
On a side note... It's <script type="text/javascript">, not <script text="text/javascript">
-
I feel stupid now, I moved the files to my public_html dir but didn't change the include path in test.php ._. Thanks for your help! ^^
-
Ajax is used just because you don't want to reload pages, so you dynamically load additional data via XMLHttpRequests. As trq said, try looking up the basics of Ajax. If you want to prevent the page from reloading when submitting a form, use jQuery(document.forms).submit(function(e){ e.preventDefault(); /* your code here */ });
-
Okay, I have a file on my webhost server (000webhost, if that is important) called HTML.class.php whose only purpose is to print HTML documents automatically, eventually reading out a meta.txt file to print out <meta> tags. So far, so good, that isn't much of a problem, I fixed my syntax and proof-read it, but when I open the file in a browser, I get three warnings and a fatal because include/require (I tried both) failed. Below the output I get (excuse the formating, my mobile won't let me copy things as I want to, so I extracted the source code). <b>Warning</b>: include() [<a href='function.include'>function.include</a>]: open_basedir restriction in effect. File(/sys/important/HTML.class.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in <b>/home/myusername/public_html/test.php</b> on line <b>3</b><br /><br /><b>Warning</b>: include(/sys/important/HTML.class.php) [<a href='function.include'>function.include</a>]: failed to open stream: Operation not permitted in <b>/home/a1632545/public_html/test.php</b> on line <b>3</b><br /><b>Warning</b>: include() [<a href='function.include'>function.include</a>]: Failed opening '/sys/important/HTML.class.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in <b>/home/myusername/public_html/test.php</b> on line <b>3</b><br /><b>Fatal error</b>: Class 'HTML_Create' not found in <b>/home/myusername/public_html/test.php</b> on line <b>5</b>Thanks in advance for your support.
-
Here is a link to the jQuery JavaScript style documentation: http://contribute.jquery.org/style-guide/js/ I suggest you take a look at it there. Use the tabulator key to properly indent your text. <html> <head /> <body /> </html> Above is properly indented text (even though it's broken down to the most simple HTML document possible. Below is not properly indented text and it is much harder to read than the above. <html><head /><body /></html> Hope that this gives you an idea how to format your code so that people reading the code (us, in this context), don't have to decipher that massive block of code.
-
What exactly do you need? Do you have any kind of code you could provide?
-
Well, theoretically, yes, you could set it with the same code I posted above, just that instead of directly applying it, you'd have to set a document.cookie value and then evaluate the document again, but I think that the method I provided is simple enough.
-
Add this to your CSS. a:visited { color: rgb(130,30,100); } And then add this JavaScript to your page. window.onload = function() { var links = document.getElementsByTagName("a"); for(var i = 0, len = links.length; i < len; i++) { if(links[i].style.color == "rgb(130,30,100)") links[i].innerHTML += " (*)"; } });
-
Problems transferring a PHP array to JavaScript
Irate replied to Darkranger85's topic in Javascript Help
You can try returning an object with PHP, like this... <?php $obj = (object) [array1,array2]; json_encode($obj); ?> -
Problems transferring a PHP array to JavaScript
Irate replied to Darkranger85's topic in Javascript Help
You would laugh, JavaScript is non-strict mode throws as many warnings instead of fatals like PHP does. And the == operator attempts a whole lot of type conversions before comparing. -
Check out jQiery, the most well-known JavaScript framework and its UI, it contains many intuitive and easy to use preprogrammed widgets like the calendar widget you're looking for.
-
I noticed that I made a slight syntax error, the quote now contains the fixed code.
-
Commenting on code is a good fashion when asking for help. jQuery's documentation on good coding style is a good guideline for writing readable, comprehensible code. I stopped reading and your if(ary&&sel.form) condition check because I couldn't see any hint of comments you may have made, your for loop just is a string of data I can't read on my phone. I suggest you re-write your code and include comments. Remember, 1 hour of thinking thoroughly before coding saves 8 hours of correcting the code you have written without thinking before writing it.