Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. It wont work as PHP will first evaluates the code. If there are syntax errors it be able to parse the code.
  2. 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'); ?>
  3. 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.
  4. 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.
  5. Change this if (isset($_POST['person_type_code'])) to if (isset($_POST['person_type_code']) && in_array($row[0], $_POST['person_type_code']))
  6. Wrap your paragraphs in <p></p> tags and use the CSS text-indent property
  7. You are using incorrect style of quotes. You need to use ' or " not ‘’ or “”, these are invalid syntax
  8. 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.
  9. 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'])) {
  10. 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'];
  11. 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.
  12. 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
  13. 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
  14. 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
  15. 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.
  16. 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.
  17. No you should not remove the bracket. No one suggested that. Add the bracket back in and your code will work again.
  18. 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>'; ?>
  19. Why is break there? break should only be used within a switch/case statement
  20. 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.
  21. 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?
  22. i tried that. it is showing it has data. here is the construction code What is the output?
  23. 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.
  24. You can always do something like this define('ROOT', $_SERVER['DOCUMENT_ROOT']); include ROOT . '/path/to/file.php';
  25. 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.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.