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 4 of 4

Thread: php form action

  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php form action

    im trying to concatenate a variable once a form is submitted, is this ok?
    <?php
    $result1 = mysql_fetch_array($query1);
    echo "<form method=get action=search_by_date.php?$c_number=".$result1['C_NUMBER'].">"
    ?>

  • #2
    Regular Coder
    Join Date
    Mar 2004
    Location
    Australia
    Posts
    217
    Thanks
    0
    Thanked 1 Time in 1 Post
    try this

    PHP Code:
    <?php
    $result1 
    mysql_fetch_array($query1);
    echo 
    "<form method=\"get\" action=\"search_by_date.php?c_number=" .$result1['C_NUMBER']. "\">";
    ?>
    you dont need the $ sign when passing variables through the url
    id personally use post instead of get
    Last edited by Serex; 06-12-2005 at 01:35 AM.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Brisbane, Australia
    Posts
    181
    Thanks
    1
    Thanked 0 Times in 0 Posts
    in situations like this, it is correct W3C to use:

    Code:
    <form method="post" action="search_by_date.php">
    <input type="hidden" name="c_number" value="<?=htmlentities ($result1['C_NUMBER'])?>">
    
    </form>
    Remember, use HTMLENTITIES when you output variables into a html element so that " can be converted to &quot; and what not ...
    -mR_eGo
    _______________________
    Programming since
    3 years old.

  • #4
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mr ego, that helped me a lot, I have a webpage with an affiliation system and I echo the links on the page, ofthenthey have an id attached, wich leads to ampersands everywhere in my page. Thanks!!
    CATdude about IE6: "All your box-model are belong to us"


  •  

    Posting Permissions

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