Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Apr 2004
    Location
    Philadelphia
    Posts
    241
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Newb Writing Scripts...Debug This?

    I get this error...

    Parse error: parse error, unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /gfdhhgshsgsdhs/jacostuff.com/httpdocs/updates.php on line 3

    with this code...

    PHP Code:
    <html>
    <font face="Tunga">You Will Be Soon Redirected!</font>
    <?php 
    mail
    (
      
    "$_POST["email"];"
      
    "Welcome $_POST["name"];",
      
    Just e-mailing you to inform you that you will recieve site updatesn thanks for Joining,
      
    n      JAcostuff.com
    "); 
    ?>
    <?php 
    mail(
      "
    AnthonyHurst@spamblack.com;",
      "
    Welcome $_POST["name"];", 
      "
    Add $_POST["name"]; to the list of people receiving updates,nTheir E-mail is $_POST["email"];
    ");  
    ?>
    </html>
    Last edited by firepages; 05-19-2004 at 04:44 AM. Reason: added PHP tags for clarity

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Slap a <br> in place of every \n, that should work.

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Location
    Philadelphia
    Posts
    241
    Thanks
    2
    Thanked 5 Times in 5 Posts
    nope...same error...i think it has 2 do with puttin the variable in the e-mail address....not sure tho....anyone else know?

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It does have to do with that, you cant write: "$_POST["email"]";

    You either have to use, ''
    or not use quotes at all: $_POST[email]
    either will work...

    You need to do this every time you use post/get variables

  • #5
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    l3vi is on the right track e.g.

    PHP Code:
    <?
    mail

      
    $_POST['email'],  
      
    "Welcome {$_POST['name']}"
      
    'Just e-mailing you to inform you that you will recieve site updates
       thanks for Joining'

      
    "JAcostuff.com\n";
    "); 
    ?>
    but there are other simple parse errors (unquoted strings etc)

    to use $_POST['an_array_value'] within a " " quoted string you need to add braces around it {} (>=PHP 4.2.*) or simply concatenate ..
    "Welcome ".$_POST['name']."blah",

    $_POST[variable] , will work but technically its incorrect and will produce an E_NOTICE internally.

    You do not need the ';' at the end of PHP variables when used within a string (not that it causes an error either)

    try formatting your code as above , or at least diferently as it makes simple mistakes far easier to spot... for both you and us
    Last edited by firepages; 05-19-2004 at 04:55 AM.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Sorry about that, I just attempted to google the answer. So much for my nonexistent php skills.

  • #7
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    Quote Originally Posted by Antoniohawk
    Sorry about that, I just attempted to google the answer. So much for my nonexistent php skills.
    narrowing down what it isn't , is still part of the solution every time
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #8
    Regular Coder
    Join Date
    Apr 2004
    Location
    Philadelphia
    Posts
    241
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Thanks....Once my sites done I;m gonna have a big thank you notice on it!
    lol
    it's
    http://jacostuff.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •