www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > PHP

    PHP Discussion and technical support for using and deploying PHP based websites.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 08-08-2005, 05:37 AM
    Sheldon's Avatar
    Sheldon Sheldon is offline
    www.inboxdesign.co.nz
     
    Join Date: Feb 2005
    Location: Tauranga
    Posts: 2,053
    $_POST variable issues

    Hi i am at a bit of a misunderstanding with this issue.

    I use this code to pass the variables from page to page with hidden feilds and the print command to show the post details but is coming up like this on the pages it post's to;

    Code:
    {print \'$_POST(sname)\';}
    and the code
    PHP Code:
    <? session_start(); ?>
    <?php
    include('header.php'); ?>

    <?php if(@$_GET[sign]) { ?>

        <p class="header">Memberships</p>
          <p>If you served with New Zealand Armed Services (Army, Navy, Airforce) in;</p>
          <p>Malaya, Malaysia, Borneo, Singapore, Brunei, Thailand  - within these country's Land borders, territorial waters or air space and/or Served with any other Commonwealth Country's Armed Services in the above areas you may apply to join the Association.</p>

         <p>
         <form action="qualify.php?page=1" method="post">
           <table border="0" cellpadding="0" cellspacing="0" width="107%">
            <tr>
             <td align="left" bgcolor="#cccccc">Name</td>
             <td align="left" bgcolor="#cccccc"><input type="text" style="width:260px" name="name" tab-index="1"><span class="alert">*</span></td>
            </tr>
            <tr>
             <td align="left">Email</td>
             <td align="left"><input type="text" style="width:260px" name="email" tab-index="2"><span class="alert">*</span></td>
            </tr>
            <tr>
             <td align="left" bgcolor="#cccccc">Desired Username</td>
             <td align="left" bgcolor="#cccccc"><input type="text" style="width:260px" name="username" tab-index="3"><span class="alert">*</span></td>
            </tr>
            <tr>
             <td align="left">Password</td>
             <td align="left"><input type="text" style="width:260px" name="password" tab-index="4"><span class="alert">*</span></td>
            </tr>
             <input type="hidden" name="perms" value="3">
            <tr>
             <td align="left" bgcolor="#cccccc">Phone</td>
             <td align="left" bgcolor="#cccccc"><input type="text" style="width:260px" name="phone1" tab-index="5"><span class="alert">*</span></td>
            </tr>
            <tr>
             <td align="left">Phone (2)</td>
             <td align="left"><input type="text" style="width:260px" name="phone2" tab-index="6"></td>
            </tr>
            <tr>
             <td align="left" bgcolor="#cccccc">Address</td>
             <td align="left" bgcolor="#cccccc"><textarea rows="3" style="width:260px" name="address" tab-index="7"></textarea><span class="alert">*</span></td>
            </tr>
            <tr>
             <td align="left">City</td>
             <td align="left"><input type="text" style="width:260px" name="city" tab-index="8"><span class="alert">*</span></td>
            </tr>
            <tr>
             <td align="left" bgcolor="#cccccc">Country</td>
             <td align="left" bgcolor="#cccccc"><select name="country" />
                <option value="Asia">Asia</option>
                <option value="Australia">Australia</option>
                <option value="Austria">Austria</option>
                <option value="Belgium">Belgium</option>
                <option value="Brazil">Brazil</option>
                <option value="Borneo">Borneo</option>
                <option value="Canada">Canada</option>
                <option value="China">China</option>
                <option value="Denmark">Denmark</option>
                <option value="Europe">Europe</option>
                <option value="Finland">Finland</option>
                <option value="France">France</option>
                <option value="Germany">Germany</option>
                <option value="Hong Kong">Hong Kong</option>
                <option value="India">India</option>
                <option value="Ireland">Ireland</option>
                <option value="Italy">Italy</option>
                <option value="Japan">Japan</option>
                <option value="Korea">Korea</option>
                <option value="Latin America">Latin America</option>
                <option value="Malaysia">Malaysia</option>
                <option value="Mexico">Mexico</option>
                <option value="Netherlands">Netherlands</option>
                <option value="New Zealand" selected>New Zealand</option>
                <option value="Norway">Norway</option>
                <option value="Singapore">Singapore</option>
                <option value="South Africa">South Africa</option>
                <option value="Spain">Spain</option>
                <option value="Sweden">Sweden</option>
                <option value="Switzerland">Switzerland</option>
                <option value="Taiwan">Taiwan</option>
                <option value="UK">UK</option>
                <option value="USA">United States</option>
                <option value="Other">Other</option>
            </select><span class="alert">*</span></td>
            </tr>        
            <tr>
             <td align="left">Served</td>
             <td align="left"><input type="text" style="width:260px" name="served" tab-index="9"></td>
            </tr>      
            <tr>
             <td align="left" bgcolor="#cccccc">Unit</td>
             <td align="left" bgcolor="#cccccc"><input type="text" style="width:260px" name="unit" tab-index="10"></td>
            </tr>      
            <tr>
             <td align="left">Service Number</td>
             <td align="left"><input type="text" style="width:260px" name="snumber" tab-index="11"></td>
            </tr>
            <tr>
             <td colspan="2" align="center">
              <p>Add a few commments about yourself, but please remember what you enter in here will be visable to every member when logged in.</p>
               <p>
                <textarea rows="8" style="width:260px" name="comments" tab-index="1"></textarea><br />
               </p>
             </td>
            </tr>
            <tr>
             <td align="left" bgcolor="#cccccc"></td>
             <td align="left" bgcolor="#cccccc"><input type="submit" style="width:260px" value="Continue"></td>
            </tr>
           </table>
           
          </form>
         
         <?php }elseif(@$_GET["page"]) { ?>
          <form action="qualify.php?activation=1" method="post">
          <?php
            $putinguestbook
    ="INSERT INTO users(name, email, username, password,perms, phone1, phone2, address, city, country, served, unit, snumber, comments)
            VALUES('$name','$email','$username','$password','$perms','$phone1','$phone2','$address','$city','$country','$served','$unit','$snumber','$comments')"
    ;
            
    mysql_query($putinguestbook);
            
           print
    '<pre>';
           
    print_r($_POST);
           print
    '</pre>';
           
           print
    'Your Information has been entered into our Database.';
           
          
    ?>
           
            <input type="hidden" value="{print '$_POST(name)';}" name="sname">
            <input type="hidden" value="{print '$_POST(email)';}" name="semail">
            <input type="hidden" value="{print '$_POST(password)';}" name="spass">
            <input type="hidden" value="{print '$_POST(username)';}" name="suser">
            <input type="submit" value="Continue">
           </form>
            
            <?php }elseif(@$_GET["activation"]) { ?>
           <p class="header">Completed!</p>
            <form action="qualify.php?complete=1" method="post">
             <p>
             Click Continue to receive an email to your selected address with your account settings.
             Name: - <?php print($_POST['sname']); ?> <br>
             Email: - <?php print($_POST['semail']); ?> <br>
             Username: - <?php print($_POST['suser']); ?> <br>
             Password: - <?php print($_POST['spass']); ?> <br>
             <i>Use your username and password to log in to this site to veiw or add news and links, and for more features like searching other members and getting the contact details of an old friend or service man.</i>
             </p>
             <p>
             <input type="hidden" value="{print '$_POST(sname)';}" name="jname">
            <input type="hidden" value="{print '$_POST(semail)';}" name="jemail">
            <input type="hidden" value="{print '$_POST(spass)';}" name="jpass">
            <input type="hidden" value="{print '$_POST(suser)';}" name="juser">
              <input type="submit" value="Continue">
             </p>
            
           </form>
           
         
         <?php }elseif(@$_GET["complete"]) {
         
         
    $recipient = "{$_POST['jemail']}";
         
    $subject = "Registration Complete- MVA Inc";
         
    $sidrecipient = $global_email;
         
    $sender = "Malayan Veterans Association Inc";
         
    $headers = "From: $sender\r\nReply-to: $sender";
       
         
    $email = $_POST['jemail'];    
         
    $name = $_POST['jname'];    
         
    $user = $_POST['juser'];    
         
    $pass = $_POST['jpass'];    
         
         
    $input = "Thank you for Joining the Malayan Veterans Association Inc\n
                   your Registration Details are\n\n
                   Username: $user\n
                   Password: $pass\n\n\n\n
                   If you forget your username or password you can retreive them from the website or this link\nhttp://www.malaysianveterens.co.nz/forgotpassword.php\n and enter in your email address: $email\n\n\n\nThank you,\n\n
                   Malayan Veterans Association Inc 2005.\n"
    ;
                   
         
    $sidinput = "$jname has joined the Malayan Veterans Association Inc\n
                   Their Registration Details are\n\n
                   Name: $name\n
                   Email: $email\n\n\n\nThank you,\n\n
                   Malayan Veterans Association Inc 2005.\n"
    ;
         
    mail($recipient, $subject, $input, $headers);
         
    mail($sidrecipient, $subject, $sidinput, $headers);
         
         
    ?>
         
         
         Thanks you have just been registered.<br />
         <a href="index.php">Continue to Login</a /><br />
         <?php } ?>
       
          
          
    <?php include('footer.php'); ?>
    and this is the response email that i receive.

    Code:
    {print \'$_POST(sname)\';} has joined the Malayan Veterans Association Inc
    
                   Their Registration Details are
    
    
                   Name: {print \'$_POST(sname)\';}
    
                   Email: {print \'$_POST(semail)\';}
    
    
    
    Thank you,
    
    
                   Malayan Veterans Association Inc 2005.


    Thanks Sheldon.
    __________________
    Auckland, New Zealand, Web Design & Hosting. - Inbox Design

    Sheldon Lendrum, Technology, PHP, Mootools & More...

    Simple Site a Completely Dynamic site using text files, PHP and no mySQL.
    Reply With Quote
      #2  
    Old 08-08-2005, 05:54 AM
    NogDog's Avatar
    NogDog NogDog is online now
    High Energy Magic Dept.
     
    Join Date: Aug 2004
    Location: Ankh-Morpork
    Posts: 14,008
    Perhaps you need some <?php...?> tags around that?
    __________________
    "That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett
    freelancer.internet.com
    Email me
    Reply With Quote
      #3  
    Old 08-08-2005, 09:18 AM
    ffurnai's Avatar
    ffurnai ffurnai is offline
    Some Guy learning PHP
     
    Join Date: Feb 2005
    Location: Pendleton, SC USA
    Posts: 277
    Quote:
    Originally Posted by NogDog
    Perhaps you need some <?php...?> tags around that?
    that'd be my guess too.

    PHP Code:
    <input type="hidden" value=" <?php print($_POST['name']); ?> " name="sname">
    <input type="hidden" value=" <?php print($_POST['email']); ?> " name="semail">
    <input type="hidden" value=" <?php print($_POST['password']); ?> " name="spass">
    <input type="hidden" value=" <?php print($_POST['username']); ?> " name="suser">
    <input type="submit" value="Continue">
    __________________
    My site - yes, the unfinished feel of it is intentional (not really)
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:24 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.