wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
If you are including a file via the http:// protocol then no PHP source code will be included in your script. Only the output of the remote php script will be included which will be text/html
-
Read my post above!
-
PHP5.2.x (or 5.1.x can remember which) introduced a new PHP directive called allow_url_include. By default this is disabled by default for security reasons. This may be why your include is not working. You should use file_get_contents instead rather than include. If you're getting external html content from a remote site.
-
how do i write a nested loop to make a grid
wildteen88 replied to digitalmartyr's topic in PHP Coding Help
Yes you can use a while loop, just make a counter for the $i variable: echo "<table border=\"1\">"; // initiate counter $i = 0; while($info = mysql_fetch_array($data)) { $html = '<div id="productThumb">'; $html .= '<h3>product id: '.$info['product_id'].'</h3>'; $html .= '<h2>product name: '.$info['product_name'].'</h2>'; $html .= '<img height="140" width="100" src="'.$info['product_img'].'"</img>'; $html .= '<span>Product Describtion '.$info['product_dscrb'].'</span>'; $html .= '</div>'; if(($i + 1) % 3 = 1){ echo "<tr><td>$html</td>"; } elseif(($i + 1) % 3 = 2){ echo "<td>$html</td>"; } elseif(($i + 1) % 3 = 0){ echo "<td>$html</td></tr>"; } // increment counter $i++; // unset html var unset($html); } echo "</table>"; -
Is this the correct way to add to a variable?
wildteen88 replied to HughbertD's topic in PHP Coding Help
Make sure you are grabbing the existing value for the URL variable startrow, ge: $startrow = $_GET['startrow']; Otherwise the startrow variable wont increment. // grab current startrow value $startrow = $_GET['startrow']; // display link and increment startrow by 10 echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'">Next</a>'; -
example: <?php // example data $details = 'Paragraph1, paragraph1 paragraph1. Paragraph2, paragraph2 paragraph2.'; // standardise new lines $details = str_replace(array("\r\n", "\r", "\n"), "\n", $details); // seperate paragraphs // $para1 <- paragraph1 // $para2 <- paragraph2 list($para1, $para2) = explode("\n\n", $details); // display formated paragraphs echo '<p><b>' . $para1 . '</b></p><p>' . $para2 . '</p>'; ?>
-
Also can you define what you mean by: How are you opening the file in IE? Make sure you are going to http://localhost/ in order to run your .php files. You cannot run them by going to File > Open or Right click > Open With... > IE to run them. Web browsers do not understand PHP. Also ensure you are saving your .PHP files with a .php file extension and not .php.txt. By default Windows will hide file extensions when browsing files in Windows Explorer. I would recommend you to disable a setting called Hide extension for know file types by going to Tools > Folder Options > View Tab within any open directory. Another note is all .php files must be saved in Apaches document root, Default will be C:/program files/Apache foundation/Apache2/htdocs (depending on version you have installed)
-
I need a PHP4 windows binary
wildteen88 replied to testtesttesttest's topic in PHP Installation and Configuration
PHP can run scripts from the command line, regardless of the version your have. just run the following command, from the command prompt: php- h That will list available flags the PHP executable accepts. For running a php file just run: php -f C:/path/to/file.php NOTE: you'll need to cd (change directory) to where php.exe is located in order for the php command to be recognised by Windows. If you don't want to do this add PHP to PATH Environment Variable instead. Also have a read of the following page in the manual: Using PHP from the command line -
Just download the zipped binaries package from php.net and copy the php.ini-recommended file from the zip file. Rename it php.ini (overwriting/deleting your existing one) and configure PHP to your liking. Retest your script.
-
That code is correct as it displays the beginning date for the current week which is 4-2-2008 if you want the current date, just run date('d - m - Y');
-
Functions are case-insensitive. Ony variables are case-sensitive @rofl90 Notices are not errors. I'd recommend you to change your code to: <?php if(isset($_POST['Submit'])) { $EmailFrom = "[email protected]"; $EmailTo = "[email protected]"; $Subject = "Contact form"; $Name = Trim(stripslashes($_POST['Name2'])); $Tel = Trim(stripslashes($_POST['Tel2'])); $Email = Trim(stripslashes($_POST['Email2'])); $Website = Trim(stripslashes($_POST['Website2'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=main.php\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Website: "; $Body .= $Website; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=main.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=main.php\">"; } } ?> Your input fields where named as Name2, Tel2, Email2, Website2 etc rather than Name, Tel, Email, Website
-
You need to forward port 80 thats it.
-
What brand/model router do you have? Go to http://portforward.com to configure your router for port forwarding.
-
Is the link above you posted your current php.ini? If it is then your ext folder is located in C:/Program Files/PHP You should of changed C:/php to the actual path you installed PHP to (as mentioned in the FAQ). As you have you used the installer, go a head an download the zipped package from php.net instead and extract the contents of the zip to where you have installed PHP to. Making sure you overwrite existing files. The installer comes with limited files/extensions. Make sure whenever you are modifying the php.ini that your restart IIS. Also verify that php is using the php.ini your are editing too by running phpinfo() function within a script. The line that reads Loaded Configuration File should stat the path to the php.ini PHP is reading.
-
Well this has nothing to do with PHP. This is more of a javascript question. What parameters does the (javascript) popitup function allow?
-
To get the hostname (phpfreaks.com) you'd use $_SERVER['SERVER_NAME'] so the following script will output the sites url: <?php echo 'http://www.' . $_SERVER['SERVER_NAME']; ?>
-
I already have WAMP5 V2.0 installed. the link that is in my post leads to my locally hosted site. I know there is the site to see if there are any error's in *.css files, I would have thought there was one for PHP also. PHP has a builtin debugger. Make sure you have enabled a setting called display_errors within the php.ini and that the error_reporting directive is to E_ALL Save your php.ini and restart WAMP. When PHP processes scripts it'll now display errors during runtime. Also when I goto the following link: http://thatoneserver.sytes.net/ and view the Source code via my browser I can see your PHP code - This is the reason why your page isn't displaying at it should. The reason for this is because you're using short tags (<? ?> or <?= ?>) these tags are not enabled by default. Either convert the short tags to full tags (<?php ?>) or enable a setting called short_open_tag within the php.ini No PHP code should ever be returned to the browser. PHP is parsed server side, what is sent back to the browser is the output of the parsed script. Web browsers do not understand PHP code.
-
Add PHP to the Path Environment Variable instead. I do not recommend moving files outside of the PHP's installation folder this can cause more problems, especially when upgrading.
-
Those two lines should be like so: ScriptAlias /php/ "C:/Program Files/PHP/" Action application/x-httpd-php "/php/php-cgi.exe"
-
[SOLVED] Php.iin Configuration
wildteen88 replied to yandoo's topic in PHP Installation and Configuration
Ajax is related to your web browser. Ajax has nothing to do with php. -
By default background images will repeat. If you don't want them to repeat add: background-repeat: no-repeat; To your style.
-
You cannot call functions from within a HEREDOC statement, only variables
-
php 5.2.5 not working on Apache 2.2.8
wildteen88 replied to obyno's topic in PHP Installation and Configuration
Umm, I have not used PHP as CGI before. However I have managed to install PHP as CGI Binary. I used the following configuration in my httpd.conf: <Directory "C:/Server/PHP"> AllowOverride None Options None Order allow,deny Allow from all </Directory> ScriptAlias /php/ "C:/Server/PHP/" AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php-cgi.exe" NOTE: C:/Server/PHP is where I have installed PHP to. Change C:/Server/PHP to your PHP installation path. Edit: Just to note I am using Apache2.2.6 and PHP5.2.4 -
[SOLVED] session_start(): Cannot send session cache limiter -
wildteen88 replied to Tylor_Famous's topic in PHP Coding Help
I presume the above code gets included in index.php file? If so the reason you are getting the error is because index.php is outputting some form of data (be it text/html/whitespace) on/around line 13. I would recommend you to remove session_start() function from the above code and place it at the top of parent file (index.php) instead. You do need to add session_start() to files which get included. Included files don't get parsed separately.