wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
[SOLVED] php includes with unbalanced braces
wildteen88 replied to poleposters's topic in PHP Coding Help
It wont work as PHP will first evaluates the code. If there are syntax errors it be able to parse the code. -
[SOLVED] php includes with unbalanced braces
wildteen88 replied to poleposters's topic in PHP Coding Help
No this is not possible. You're better of just doing <?php session_start(); if(!isset($_SESSION['name'])) { header("Location:/admin/login.php?ref=12"); exit; } require_once($_SERVER['DOCUMENT_ROOT'].'/mysql_connect.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/config.inc.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/fckeditor/fckeditor.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/ref.php'); ?> -
I deally you should not be using tables for layouts. However for you want to do is use the min-height CSS property on your table.
-
displaying <?php echo $something; ?> from mysql database
wildteen88 replied to c_shelswell's topic in PHP Coding Help
PHP will not parse constants or any other PHP code, such as variables, functions etc within strings. You will need to use eval to parse PHP code within strings. However be very careful with how you use this function. -
Change this if (isset($_POST['person_type_code'])) to if (isset($_POST['person_type_code']) && in_array($row[0], $_POST['person_type_code']))
-
Wrap your paragraphs in <p></p> tags and use the CSS text-indent property
-
You are using incorrect style of quotes. You need to use ' or " not ‘’ or “”, these are invalid syntax
-
No, isset checks whether $_SESSION['post']['Obituary_ID'] is defined. empty checks whether the variable is emtpy. I always use isset before using _GET, _POST, _COOKIE or _SESSION variables.
-
This if ($_POST && !empty($_SESSION['post']['Obituary_ID'])) { needs to be echo '<pre>'.print_r($_SESSION['post'], true).'</pre>'; if (isset($_SESSION['post']['Obituary_ID']) && !empty($_SESSION['post']['Obituary_ID'])) {
-
In your next page you need to use $_SESSION['post'] instead of $_POST So instead of $_SESSION['Obituary_ID']; you'd use $_SESSION['post']['Obituary_ID'];
-
That doesnt help the situation. They both do they same thing. The only difference is require will kill the script if it cant include the requested file.
-
return does not act as global. If you pass return a variable it will return the value of that variable. As you are now returning a value from your function you will need to capture this value when you call the function eg $my_var = your_function(); $my_var will capture what was returned from your function. So this line stuff(hq,$dbc); needs to be $passed = stuff(hq,$dbc); You should have a read up on the return keyword in the manual here
-
Oh hang on I just saw these lines in your code //redirect page of $Obituary_ID is invalid if ($done || !isset($Obituary_ID)) { header('Location: /throops/thanks_guestbook.php'); exit; } } You wont be able to access your $_POST variables in thanks_guestbook.php. $_POST will be only available to the page you submit the form to. If you want to use the $_POST data in that page you'll have to save the variables you want to carry using sessions. Change this line include('includes/connection.inc.php'); to session_start(); // must be called whenever you use $_SESSION's include('includes/connection.inc.php'); Now change header('Location: /throops/thanks_guestbook.php'); to $_SESSION['post'] = $_POST; header('Location: /throops/thanks_guestbook.php'); Now in thanks_guestbook.php make sure you call session_start() at the top of script. Use $_SESSION['post'] to access the $_POST data
-
Mini File host Image upload problem
wildteen88 replied to zysac's topic in PHP Installation and Configuration
Yellowtip is extemely outdated you should use WAMP or XAMPP. The reason you got errors hte last time with WAMP/XAMPP is becuase the script you're using uses tags such as <? ?> or <?= ?> which are called short tags. By default these are disabled. However they can be enabled by editing the php.ini and enabling a setting called short_open_tag -
Few problems I see. session_register should not be used, it is depreciated. Remove it completely from your code. The main problem I see is you're not calling [m]session_start[/b]. This must be called at the top of your script whenever you are using sessions.
-
if you dont set the action the form will submit to itself. You only need to set the action if you're submitting the form to different page. Is that before or after you submit the form? $_POST will be empty if you don't submit the form. You show add in the code I suggested, fill in your form and submit it. It should print the contents of the $_POST array.
-
[SOLVED] Fatal error: Cannot break/continue 1 level.....
wildteen88 replied to iamz3r0's topic in PHP Coding Help
No you should not remove the bracket. No one suggested that. Add the bracket back in and your code will work again. -
First check I'd make is to see if the hidden input field is being populated <?php echo 'Temp check, OB_ID = ' .$row['OB_ID']; ?> <input name="O_ID" type="hidden" value="<?php echo $row['OB_ID']; ?>"> Is it populated? If the field is populated. Is the $_POST populated correctly in the page the form gets submitted to <?php echo '<pre>'.print_r($_POST, true).'</pre>'; ?>
-
[SOLVED] Fatal error: Cannot break/continue 1 level.....
wildteen88 replied to iamz3r0's topic in PHP Coding Help
Why is break there? break should only be used within a switch/case statement -
pluto You should note that the following highlighted lines Should be outside of your loop. Otherwise they will be defined more than once, which will cause invalid HTML.
-
I assume by double arrow you mean this foreach($dataArray as $nameArr => $artistArr => $genreArr) No this is not possible. You'll have to use a subarray. Whats wrong with using a sub array?
-
i tried that. it is showing it has data. here is the construction code What is the output?
-
foreach is expecting an array. The variables $contents, $tmp or $contents2 dont appear to be an array. Can you post how your flat file database is formatted/constructed.
-
You can always do something like this define('ROOT', $_SERVER['DOCUMENT_ROOT']); include ROOT . '/path/to/file.php';
-
[SOLVED] PHP-IIS coding problem
wildteen88 replied to johnojohnson's topic in PHP Installation and Configuration
You're not ending your lines properly. At the end of each line you need place a semi-colon (. Correct code <?php echo "Hello World"; $TextVar = "Hello World"; echo $TextVar; ?> Note: You should turn errors on in your php.ini. Make sure error_reporting is set to E_ALL and that display_errors is set to on.