forms - Pass php variable to another php page -


Is my unique $ comment-> comment_id; Is it possible to pass to another php file? I need the same ID for that input button for li When clicked, I will call the variable php "/ model / editcomment.php" .

  and 
& Lt; Ul class = "comment-button-holder-ul" & gt; & Lt; Li id = "& lt ;? php $ comment-> Comment_id ;? & gt;" Class = "edited-btn" & gt; & Lt; Form action = "/ model / editcomment.php" method = "post" & gt; & Lt; Input & gt; "Type" "Submit" value = "edit" & gt; & Lt; / Form & gt; & Lt; / Li & gt; & Lt;
    / Div & gt;

    using post

    you've got a form . Use hidden input.

      & lt; Input type = "hidden" name = "comment_id" value = "& lt; php echo $ comment-> comment_id;  
      $ intCommentId = (isset ($ _ POST ['comment_id '] And    

    ]) and ctype_digit (string) $ _POST [' comment_id ']))? (Int) $ _POST [' comment_id ']: 0; < / Code>

    get access

    Add it to the Action URL in the query string.

      
    action = "/ model / editcomment .php? Id = & lt ;? Php $ echo $ comment-> Comment_id; ? & Gt; "

    On your edit comet.php page, you want; $ intCommentId = (isset ($ _GET ['id']) and Ctype_digit (String) $ _GET ['id']))? (Int) $ _GET ['id']: 0;

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

java - Session timeout does't work vaadin -