SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php post problem

    hello people
    I have this page where i am using an echo to display all textboxes for a form.

    PHP Code:
    //display button
    if($number_of_fields >=1){
        
    $buttonshow "<input type='submit' name='submit' value='Add Photos' />";
    }


    // Lets build the Photo Uploading fields
        
    while( $counter <= $number_of_fields )
        {
    $photo_upload_fields .=<<<__HTML_END
    <tr>
        <td>
             Photo 
    {$counter}:
            <input name=' photo_filename[]' type='file' />
        </td>
    </tr>
    <tr>
        <td>
             Caption:
            <textarea name='photo_caption[]' cols='30' rows='1'></textarea>
        
    </td>
    </tr>

    __HTML_END;
        
    $counter++;

    }


    // Final Output
    echo <<<__HTML_END

    <html>
    <head>
        <title>Lets Upload More Car Photos</title>
    </head>
    <body>
    <form enctype='multipart/form-data' action='uploadMore.php' method='post' name='upload_form'>
    <table width='90%' border='0' align='center' style='width: 90%;'>

    <tr>
        <td>
            <p>&nbsp;</p>
        </td>
    </tr>

    $photo_upload_fields
     
    <textarea name=cid' value='
    $cid' cols='30' rows='1'></textarea> 
    //TRIAL CODE HERE. TRYING TO GET THE ID. 
    <tr>
        <td>
            
    $buttonshow
        </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    __HTML_END;
    ?> 
    The problem is that when it gets posted to the next form i also need the category id which is not included in the form.

    i am trying the following code to insert a textbox (AND I MIGHT HIDE IT LATER) with the values but i cant seem to get it right coz the textbox is being echoed inside the php tag.

    PHP Code:
    <textarea name=cid' value='$cid' cols='30' rows='1'></textarea> 
    notethat the above code is inside the php statement. Its where i have inserted //TRIAL CODE HERE.

  2. #2
    SitePoint Evangelist ClickHeRe's Avatar
    Join Date
    Mar 2005
    Location
    Ottawa, Canada
    Posts
    580
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you have a ' missing around your name='cid' parameter
    David

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still the same problem with that ' being fixed

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i found a fix for it.
    took me some time. but with trial and error i managed to get it.

    i think its just a limitation with using <textarea> rather than <input>
    I dont think there is a hidden type in textarea but there is with input.

    PHP Code:
    <input type="hidden" name="cid" value="$cid"></input
    cheers


Bookmarks

Posting Permissions

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