Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. No problem; glad to help
  2. Just to clarify, it only needs to be added to pages which use SESSION variables. While I agree that session_start() should usually be at the top of the script, this case may be an exception. This script appears to have at least two stages. One to show the form and one that's activated after the form is submitted. Assuming that the SESSION variables are only used in the latter stage, the session doesn't need to be opened until the form is submitted. With that said, session_start() needs to be called before outputting anything. More information can be found here: http://php.net/manual/en/function.session-start.php
  3. As ginerjm suggested, the variables like $name are probably undefined. Since these variables seems to be coming from a form using the POST method, I would imagine this $_SESSION['name'] = $name; Should be this $_SESSION['name'] = $_POST['name']; Note that I recommend taking this one step at a time. It makes debugging easier. Before worrying about the header() redirect and the page which processes the form information, I would make sure the SESSION variables are getting the values they need. Try commenting out the header() function and just output the SESSION variables. If they contain what you need, you can move to the next step.
  4. The address definitely looks more professional when it's centered vertically. You could convert the <span> tag into an inline block and add some margins. #Header span { display: inline-block; margin: 6px; /* <-- same as the padding for #NavButton a */ }
  5. Just to clarify, are you trying to redirect visitors who go to "www.domain.com" to "domain.com"? Or are you just looking to manipulate a string? For what it's worth, PHP has a built-in function for parsing URLs: http://php.net/manual/en/function.parse-url.php You could also look at replacing the "www." part using str_replace(). Just be aware that this will replace all occurrences of "www." http://php.net/manual/en/function.str-replace.php
  6. Sorry, I'm not sure I follow. What would you like to have happen to the <span> tag? Where should it be in relation to the navigation?
  7. Here's a quick script for swapping the values: <?php //INITIALIZE VARIABLES $values = "-93.93740385636626,32.5298698657008| -93.94147866742821,32.52989552832681| -93.94144945527509,32.53330102162547| -93.94975589137293,32.53335196474311| -93.94983123242544,32.52989370087431| -93.94493319136991,32.52989645540433| -93.9443121915328,32.52861950574362| -93.94419758821717,32.52736388060429| -93.94302907878635,32.52652644904565| -93.94229993303671,32.5257441308524| -93.94147580320451,32.52521094897828| -93.94137978713827,32.52261795379491| -93.93742258613195,32.5225916055261| -93.93740385636626,32.5298698657008|"; $coords = explode('|', $values); $correctedCoords = array(); //LOOP THROUGH THE COORDINATES foreach($coords as $currLatLong) { //IF THE CURRENT ENTRY CONTAINS A VALUE, SWAP THE VALUES $currLatLong = trim($currLatLong); if($currLatLong != '') { list($val1, $val2) = explode(',', $currLatLong); $correctedCoords[] = "$val2,$val1"; } } //RE-BUILD THE STRING $correctedCoords = implode('| ', $correctedCoords); //OUTPUT RESULTS print '<pre>' . print_r($values, true) . '</pre>'; print '<pre>' . print_r($correctedCoords, true) . '</pre>'; ?>
  8. If you prefer to stick with using a header() redirect, you could save the form information into SESSION variables as ginerjm suggested. <?php if (isset($_POST['formSubmit'])) { //START A SESSION session_start(); //CREATE SESSION VARIABLES $_SESSION['name'] = $name; //... //REDIRECT VISITOR header("location: http://www.pearsonkoutcherlaw.com/abl-form-submit/"); exit; } ?> Then on the confirmation page, you would just need to open the session again to get the variables. <?php //START A SESSION session_start(); //DISPLAY CONFIRMATION print "<p style=\"font-weight:bold;\">Form has been sent!</p>"; print '<p>Thank you for your submission. </p>'; print "<p>What You Sent</p>"; print "<b>Name:</b><br/>" . htmlspecialchars($_SESSION['name']) ."<br/><br/>"; //... ?> More information about sessions can be found in the manual: http://php.net/manual/en/session.examples.basic.php
  9. Is the header() redirect needed? As an alternative, you could just display the confirmation page and provide a link to the next page (http://www.pearsonkoutcherlaw.com/abl-form-submit/).
  10. It's no problem at all. I would like to think that we've all been in your shoes at some point asking "idiot" questions. I know I've been there...and will be in the future.
  11. To merge strings, you'll need to use the concatenation character. So this: <?php $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $text"; "Here is the phone:\n $phone"; ?> Needs to be changed to this: <?php $email_body = "You have received a new message from the user $name.\n" . "Here is the message:\n $text" . "Here is the phone:\n $phone"; ?> For what it's worth, I would actually go a step further. The following code is easier to understand and is less prone to mistakes: <?php $email_body = "You have received a new message from the user $name.\n"; $email_body .= "Here is the message:\n $text"; $email_body .= "Here is the phone:\n $phone"; ?> Note the ".=" operator.
  12. Have you tried validating the code? http://validator.w3.org/ I haven't had any issues (that I know of) with forms and iPhones, but I know that invalid code can lead to odd behavior in browsers.
  13. You could use a PDF generator like FPDF: http://www.fpdf.org/
  14. Are you okay with the page reloading each time the button is clicked? If so, you could look into using PHP's Event class for the timer: http://php.net/manual/en/event.addtimer.php However, if you want the button(s) to start / stop the timer without reloading the page, you'll need to use JavaScript.
  15. Based on the code provided, the phone field isn't being used in the script which processes the form. It needs to be incorporated like you did with the name field.
  16. IsInjected() is a user-defined function. You'll need to define the function before PHP can use it. Note that PHP has a built-in function for validating email addresses: http://php.net/manual/en/filter.examples.validation.php
  17. The email address isn't being used since it's enclosed with single quotes: $email_from = '$visitor_email \r\n"'; Variables within strings need to be enclosed in double quotes: $email_from = "$visitor_email \r\n"; Also, your form doesn't have a field named "message", so $_POST['message'] isn't going to contain anything. You have a <textarea> called "text" though.
  18. If you don't want to set the width, changing the display property also seems to work: #navigation ul { margin:auto; display:inline-block; }
  19. You could set the width of the <ul> tag: #navigation ul { margin:auto; width:500px; }
  20. You could use jQuery's .css() method: http://api.jquery.com/css/
  21. It looks like the problem is caused by the "enctype" attribute in the <form> tag. Is there a reason you are using the following: enctype="text/plain" Your code seems to work for me once the attribute is removed.
  22. I'm not sure if this is causing the issue, but you're missing a semi-colon. This $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $message". Should be: $email_body = "You have received a new message from the user $name.\n". "Here is the message:\n $message";
  23. If you're still interested in looking into the problem, it may help to post the code for the "button" shortcode?
  24. Sorry, I'm not very familiar with do_shortcode() or types_render_field(). Have you tried echoing the result from types_render_field() to see if it's what you expect? <?php echo do_shortcode('[button color="accent-color" hover_text_color_override="#fff" size="large" url="' . types_render_field("signup-link") . '" text="SIGN UP TODAY - It's Free and Secure!" color_override="#d28743"]'); echo '<p>types_render_field() Output: ' . types_render_field("signup-link") . '</p>'; ?>
  25. Perhaps you've already seen this, but there is a pinned topic for Good Programming and Web Design Books here: http://forums.phpfreaks.com/topic/2307-good-programming-and-web-design-books/ I mostly learn about things using http://php.net/ ....and of course from the lovely people here at PHPFreaks.
×
×
  • 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.