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 10 of 10
  1. #1
    p@p
    p@p is offline
    New Coder
    Join Date
    Apr 2010
    Location
    Indonesia
    Posts
    71
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Help with syntax error, unexpected T_VARIABLE

    I'm a bit confused this is a first time for me to write the some of forms used many field and i got an error with syntax error, unexpected T_VARIABLE with line 52.

    This filename is contact.php
    PHP Code:
      <table style="width: 100%" cellpadding="1" cellspacing="3"> 
        <form enctype="multipart/form-data" onSubmit="return validate_form(this)" action="mailer.php" method="post" name="odr_frm" id="odr_frm"> 
         <tr> 
                <td colspan="3" class="HeadOrd">&nbsp;&nbsp;Data Account</td> 
         </tr> 
         <tr class="isiorder"> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">E-Currency</td> 
            <td align="left"> 
                <select name="currencynya" id="currencynya" onChange="odr_frm.n_tukar.value = this.options[this.selectedIndex].value; odr_frm.ecurna.value = this.options[this.selectedIndex].text"> 
                        <option value="0">Please Choose</option> 
                            <option value="<?php 
              $sqlTampil 
    "SELECT * FROM paypal ORDER BY id";
              
    $qryTampil mysql_query($sqlTampil$koneksi
                        or die (
    "Gagal query".mysql_error());
                           
              while(
    $dataTampil=mysql_fetch_array($qryTampil)) {
              
    ?><?php echo "$dataTampil[beli]"?><?php }  ?>">PayPal</option> 
                            </select>&nbsp;
            </td> 
        </tr> 
        <tr> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left" class="isiorder">PayPal Email</td> 
            <td align="left"><input name="no_account" type="text" id="no_account">&nbsp;</td> 
        </tr> 
        <tr>
            <td align="left" style="width: 5px">*</td> 
            <td align="left">Nama Di Account </td> 
            <td align="left"><input name="nama_diacc" type="text" id="nama_diacc"></td> 
        </tr> 
        <tr class="isiorder"> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">Jumlah Beli (USD)</td> 
            <td align="left">$ <input name="jml_beli" id="jml_beli" value="0" maxlength="6" type="text" onKeyUp="javascript: odr_frm.jmltrfs.value=odr_frm.jml_beli.value*odr_frm.n_tukar.value; odr_frm.dlmbilangan.value = terbilang(odr_frm.jml_beli.value*odr_frm.n_tukar.value)" style="width: 100px">&nbsp; x&nbsp; <input name="n_tukar" id="n_tukar" type="text" size="6" maxlength="6" readonly="1"/></td> 
        </tr> 
        <tr class="isiorder"> 
            <td style="width: 5px">&nbsp;</td> 
            <td align="left">Nilai Transfer (IDR)</td> 
            <td align="left">Rp <input name="jmltrfs" id="jmltrfs" value="0" type="text" readonly="1"></td> 
        </tr> 
        <tr class="isiorder"> 
            <td style="width: 5px">&nbsp;</td> 
            <td align="left" valign="top">Terbilang</td> 
            <td align="left"><textarea readonly name="dlmbilangan" id="dlmbilangan" style="height: 71px; width: 235px"></textarea>&nbsp;</td> 
        </tr> 
        <tr class="isiorder"> 
            <td style="width: 5px">&nbsp;</td> 
            <td align="left">Keterangan</td> 
            <td align="left"><input name="ket" id="ket" type="text" style="width: 235px"></td> 
        </tr> 
        <tr class="lrnya"> 
            <td colspan="3" class="HeadOrd">&nbsp;&nbsp;Data Bank</td> 
        </tr> 
        <tr> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">Bank</td> 
            <td align="left"><select name="banknya" id="banknya"> 
                        <option value="Please Choose">Please Choose</option> 
                            <option value="BCA">BCA</option> 
                            <option value="MANDIRI">MANDIRI</option> 
                                                                                                                                    
                </select>&nbsp;</td> 
        </tr> 
        <tr> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">No Rekening</td> 
            <td align="left"><input name="no_rek" id="no_rek" type="text"> masukkan tanpa tanda baca</td> 
        </tr> 
        <tr> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">Nama Di Rekening</td> 
            <td align="left"><input name="nama_rek" id="nama_rek" type="text"></td> 
        </tr> 
        <tr> 
            <td colspan="3" class="HeadOrd">&nbsp;&nbsp;Data Pribadi</td> 
        </tr> 
        <tr> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">Nama Lengkap</td> 
            <td align="left"><input name="vnama" id="vnama" type="text" style="width: 235px"></td> 
        </tr> 
        <tr> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">Email</td> 
            <td align="left"><input name="vemail" id="vemail" type="text" style="width: 235px"></td> 
        </tr> 
        <tr> 
            <td style="width: 5px">&nbsp;</td> 
            <td align="left">Instant Mesengger</td> 
            <td align="left"><input name="vIm" id="vIm" type="text" style="width: 235px"></td> 
        </tr>    
        <tr> 
            <td style="width: 5px">&nbsp;</td> 
            <td align="left">Alamat Lengkap</td> 
            <td align="left"><input name="vkota" id="vkota" type="text" style="width: 235px"></td> 
        </tr> 
        <tr> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">No Hp</td> 
            <td align="left"><input name="vhp" id="vhp" type="text" style="width: 235px"></td> 
        </tr> 
            <tr> 
            <td align="left" style="width: 5px">*</td> 
            <td align="left">Type verification image:</td> 
            <td align="left"><img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br />
    <input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:100px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"/>
    </td> 
        </tr> 
        <tr> 
            <td style="width: 5px">&nbsp;</td> 
            <td>&nbsp;</td> 
            <td><input name="ecurna" type="hidden"> 
                <input id="data_odr_frm" name="data_odr_frm" type="hidden" value="odr_frm" /><br/><input type="image" src="img/order.gif">
            </td> 
        </tr> 
        </form> 
    </table>
    And this filename is mailer.php
    PHP Code:
    <?php
    // remember to replace you@email.com with your own email address lower in this code.

    // load the variables form address bar
    $currencynya $_POST["currencynya"];
    $no_account $_POST["no_account"];
    $nama_diacc $_POST["nama_diacc"];
    $jml_beli $_POST["jml_beli"];
    $jmltrfs $_POST["jmltrfs"];
    $dlmbilangan $_POST["dlmbilangan"];
    $ket $_POST["ket"];
    $banknya $_POST["banknya"];
    $no_rek $_POST["no_rek"];
    $nama_rek $_POST["nama_rek"];
    $vnama $_POST["vnama"];
    $vemail $_POST["vemail"];
    $vIm $_POST["vIm"];
    $vkota $_POST["vkota"];
    $vhp $_POST["vhp"];
    $verif_box $_POST["verif_box"];

    // remove the backslashes that normally appears when entering " or '
    $currencynya stripslashes($currencynya); 
    $no_account stripslashes($no_account); 
    $nama_diacc stripslashes($nama_diacc); 
    $jml_beli stripslashes($jml_beli); 
    $jmltrfs stripslashes($jmltrfs); 
    $dlmbilangan stripslashes($dlmbilangan); 
    $ket stripslashes($ket); 
    $banknya stripslashes($banknya);
    $no_rek stripslashes($no_rek);
    $nama_rek stripslashes($nama_rek);
    $vnama stripslashes($vnama);
    $vemail stripslashes($vemail);
    $vIm stripslashes($vIm);
    $vkota stripslashes($vkota);
    $vhp stripslashes($vhp);

    // check to see if verificaton code was correct
    if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
        
    // if verification code was correct send the message and show this page
        
    mail("mountainvibe@gmail.com"'Indoexechanges.com Order Form: '$_SERVER['REMOTE_ADDR']."\n\n Currency:".$currencynya"\n\n No Account".$no_account"\n\n Nama Account:".$nama_diacc"\n\n Jumlah Beli:".$jml_beli"\n\n Jumlah Transfer:".$dlmbilangan"\n\n Keterangan:".$ket"\n\n Bank Transfer:".$no_rek"\n\n Nama Di Rekening:".$nama_rek"\n Nama Lengkap:".$vname"\n\n Email:".$vemail"\n\n Instant Messenger:".$vIm"\n\n Alamat Lengkap:".$vkota"\n\n HP:".$vhp"From: $vnama");
        
    // delete the cookie so it cannot sent again by refreshing this page
        
    setcookie('tntcon','');
    } else if(isset(
    $currencynya$no_account$nama_diacc$jml_beli$jmltrfs$dlmbilangan$ket$banknya$no_rek$nama_rek$vnama$vemail$vIm$vkota$vhp) and $currencynya$no_account$nama_diacc$jml_beli$jmltrfs$dlmbilangan$ket$banknya$no_rek$nama_rek$vnama$vemail$vIm$vkota$vhp!=""){
        
    // if verification code was incorrect then return to contact page and show error
        
    header("Location: contact.php?from=$vnama&from=$from&message=".urlencode($no_account)."&wrong_code=true");
        exit;
    } else {
        echo 
    "no variables received, this page cannot be accessed directly";
        exit;
        }
    ?>
    <h1>Success</h1>
    When i submit the button from the contact.php it's will action to mailer.php and i got an error with


    Parse error: syntax error, unexpected T_VARIABLE in /home/test/public_html/mailer.php on line 52

    Perhaps someone could help me to fix the script

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,341
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    Look:
    mail("mountainvibe@gmail.com", 'Indoexechanges.com Order Form: '$_

    Shouldn't there be a . somewhere?- From: ' . $_
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    p@p
    p@p is offline
    New Coder
    Join Date
    Apr 2010
    Location
    Indonesia
    Posts
    71
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tangoforce View Post
    Look:
    mail("mountainvibe@gmail.com", 'Indoexechanges.com Order Form: '$_

    Shouldn't there be a . somewhere?- From: ' . $_
    When i added this in mailer.php on line 52

    PHP Code:
    mail("mountainvibe@gmail.com"'Indoexechanges.com Order Form: '.$_SERVER['REMOTE_ADDR']."\n\n Currency:".$currencynya"\n\n No Account".$no_account"\n\n Nama Account:".$nama_diacc"\n\n Jumlah Beli:".$jml_beli"\n\n Jumlah Transfer:".$dlmbilangan"\n\n Keterangan:".$ket"\n\n Bank Transfer:".$no_rek"\n\n Nama Di Rekening:".$nama_rek"\n Nama Lengkap:".$vname"\n\n Email:".$vemail"\n\n Instant Messenger:".$vIm"\n\n Alamat Lengkap:".$vkota"\n\n HP:".$vhp"From: $vnama");
        
    // delete the cookie so it cannot sent again by refreshing this page 
    I got another error: Parse error: syntax error, unexpected ',' in /home/indoex/public_html/mailer.php on line 55

    On line 55 in mailer.php:
    PHP Code:
    } else if(isset($currencynya$no_account$nama_diacc$jml_beli$jmltrfs$dlmbilangan$ket$banknya$no_rek$nama_rek$vnama$vemail$vIm$vkota$vhp) and $currencynya$no_account$nama_diacc$jml_beli$jmltrfs$dlmbilangan$ket$banknya$no_rek$nama_rek$vnama$vemail$vIm$vkota$vhp!=""){
        
    // if verification code was incorrect then return to contact page and show error
        
    header("Location: contact.php?from=$vnama&from=$from&message=".urlencode($no_account)."&wrong_code=true");
        exit;
    } else {
        echo 
    "no variables received, this page cannot be accessed directly";
        exit;
        }
    ?> 
    Could you help me?

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,341
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    The php debugger can often be wrong about line numbers.

    Please the entire revised code and also check out the link in my signature about coding styles.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #5
    p@p
    p@p is offline
    New Coder
    Join Date
    Apr 2010
    Location
    Indonesia
    Posts
    71
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tangoforce View Post
    The php debugger can often be wrong about line numbers.

    Please the entire revised code and also check out the link in my signature about coding styles.
    I was edit on line 52 - 61

    PHP Code:
        // if verification code was correct send the message and show this page
        
    mail("mountainvibe@gmail.com"'Indoexechanges.com Order Form: '.$vnama,$_SERVER['REMOTE_ADDR']."\n\n Currency:".$currencynya"\n\n No Account".$no_account"\n\n Nama Account:".$nama_diacc"\n\n Jumlah Beli:".$jml_beli"\n\n Jumlah Transfer:".$dlmbilangan"\n\n Keterangan:".$ket"\n\n Bank Transfer:".$no_rek"\n\n Nama Di Rekening:".$nama_rek"\n Nama Lengkap:".$vnama"\n\n Email:".$vemail"\n\n Instant Messenger:".$vIm"\n\n Alamat Lengkap:".$vkota"\n\n HP:".$vhp"From: $vnama");
        
    // delete the cookie so it cannot sent again by refreshing this page
        
    setcookie('tntcon','');

     else if(isset(
    $currencynya,$no_account,$nama_diacc,$jml_beli,$jmltrfs,$dlmbilangan,$ket,$banknya,$no_rek,$nama_rek,$vnama,$vemail,$vIm,$vkota,$vhp) and $currencynya,$no_account,$nama_diacc,$jml_beli,$jmltrfs,$dlmbilangan,$ket,$banknya,$no_rek,$nama_rek,$vnama,$vemail,$vIm,$vkota,$vhp!=""){
           
    // if verification code was incorrect then return to contact page and show error
        
    header("Location: contact.php?from=$vnama&from=$no_account&message=".urlencode($no_account)."&wrong_code=true");
        exit;

    But still getting an error Parse error: syntax error, unexpected ',' in /home/test/public_html/mailer.php on line 57
    Last edited by p@p; 05-24-2011 at 07:18 PM.

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,341
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    The internal one php uses to find these errors...

    I don't know how many mail parameters you're trying to pass but you're trying to pass too many - look how many commas (,) you're using:
    PHP Code:
        mail("mountainvibe@gmail.com",//Email address
        
    'Indoexechanges.com Order Form: '//Subject
        
    .$_SERVER['REMOTE_ADDR']."\n\n Currency:"//Subject (on a new line???)
        
    .$currencynya//Subject
        
    "\n\n No Account".$no_account//Message
        
    "\n\n Nama Account:".$nama_diacc//Additional Headers
        
    "\n\n Jumlah Beli:".$jml_beli//Additional Parameters
        
    "\n\n Jumlah Transfer:".$dlmbilangan//Doesn't exist
        
    "\n\n Keterangan:".$ket//Doesn't exist
        
    "\n\n Bank Transfer:".$no_rek//Doesn't exist
        
    "\n\n Nama Di Rekening:".$nama_rek//Doesn't exist
        
    "\n Nama Lengkap:".$vname//Doesn't exist
        
    "\n\n Email:".$vemail//Doesn't exist
        
    "\n\n Instant Messenger:".$vIm//Doesn't exist
        
    "\n\n Alamat Lengkap:".$vkota//Doesn't exist
        
    "\n\n HP:".$vhp//Doesn't exist
        
    "From: $vnama");// Shouldn't this be a header? 
    This is the mail() function and parameter format from php.net:
    mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

    As you can see, there is a maximum of 5 parameters seperated by a ,

    I've never seen this before:
    PHP Code:
    and $currencynya$no_account$nama_diacc$jml_beli$jmltrfs$dlmbilangan$ket$banknya$no_rek$nama_rek$vnama$vemail$vIm$vkota$vhp!=""){ 
    It can't be done. You have to check them all individually.

    Edit:
    You can use 'and' between your variables instead of ,
    Last edited by tangoforce; 05-24-2011 at 07:39 PM.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #7
    p@p
    p@p is offline
    New Coder
    Join Date
    Apr 2010
    Location
    Indonesia
    Posts
    71
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tangoforce View Post
    The internal one php uses to find these errors...

    I don't know how many mail parameters you're trying to pass but you're trying to pass too many - look how many commas (,) you're using:
    PHP Code:
        mail("mountainvibe@gmail.com",//Email address
        
    'Indoexechanges.com Order Form: '//Subject
        
    .$_SERVER['REMOTE_ADDR']."\n\n Currency:"//Subject (on a new line???)
        
    .$currencynya//Subject
        
    "\n\n No Account".$no_account//Message
        
    "\n\n Nama Account:".$nama_diacc//Additional Headers
        
    "\n\n Jumlah Beli:".$jml_beli//Additional Parameters
        
    "\n\n Jumlah Transfer:".$dlmbilangan//Doesn't exist
        
    "\n\n Keterangan:".$ket//Doesn't exist
        
    "\n\n Bank Transfer:".$no_rek//Doesn't exist
        
    "\n\n Nama Di Rekening:".$nama_rek//Doesn't exist
        
    "\n Nama Lengkap:".$vname//Doesn't exist
        
    "\n\n Email:".$vemail//Doesn't exist
        
    "\n\n Instant Messenger:".$vIm//Doesn't exist
        
    "\n\n Alamat Lengkap:".$vkota//Doesn't exist
        
    "\n\n HP:".$vhp//Doesn't exist
        
    "From: $vnama");// Shouldn't this be a header? 
    This is the mail() function and parameter format from php.net:
    mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

    As you can see, there is a maximum of 5 parameters seperated by a ,

    I've never seen this before:
    PHP Code:
    and $currencynya$no_account$nama_diacc$jml_beli$jmltrfs$dlmbilangan$ket$banknya$no_rek$nama_rek$vnama$vemail$vIm$vkota$vhp!=""){ 
    It can't be done. You have to check them all individually.

    Edit:
    You can use 'and' between your variables instead of ,
    When I'm edited on line 73 to:
    PHP Code:
      else if(isset($currencynya$no_account$nama_diacc$jml_beli$jmltrfs$dlmbilangan$ket$banknya$no_rek$nama_rek$vnama$vemail$vIm$vkota$vhp) {
           
    // if verification code was incorrect then return to contact page and show error
        
    header("Location: contact.php?from=$vnama&from=$no_account&message=".urlencode($no_account)."&wrong_code=true");
        exit;

    It's still shown an error Parse error: syntax error, unexpected '{' in /home/test/public_html/mailer.php on line 73

  • #8
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,341
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    I've already pointed you to my topic about the $end errors and coding styles in post 4. You've ignored it and are now asking about a problem with a { ?
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #9
    p@p
    p@p is offline
    New Coder
    Join Date
    Apr 2010
    Location
    Indonesia
    Posts
    71
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Any help?? I'm not just asking to you. This forum is for public and I'm asking not just for you, I don't think so following your post 8 it will given the error. If that give an error then why I was looked some site used more than 5 variable it's possible? Huh??!!

  • #10
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,341
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    I've seen several websites which offer the wrong php advice which completely contradicts the php.net manual.

    I have no idea what you're trying to say about 5 variables in post 8.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Posting Permissions

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