get text wrote in html paragraph using PHP - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, June 12, 2021

get text wrote in html paragraph using PHP

I've a paragraph contains some data which I want to insert these data into database, but when I try to insert these data into database PHP return an error this is my PHP code

if($conn->connect_error){
            die("Connection Failed ". mysqli_connect_error());
        } else{
            //connection successfull so do something ...
            $name = $_POST['seq_name'];
            $seq = $_POST['Seq'];
            $GC = $_POST['result1'];
            $Comp = $_POST['result2'];
            $Trans = $_POST['result3'];
            $Rev = $_POST['result4'];

            //GC button is clicked
            if($_POST['btn'] == 'functions'){
                $sql = "insert into functions (seq_name,sequence,GC,complement,rev_comp,transcript) values('$name','$seq','$GC','$Comp','$Rev','$Trans')";
                
                if($conn->query($sql) === TRUE) {
                    echo "<h3>Successfully inserted</h3>";
                    echo "<br>";
                    echo "GC Content is : ". $GC;
                    echo "<br>";
                    echo "Complement for entered sequence is : ". $Comp;
                    echo "<br>";
                    echo "Reverse Complement for entered sequence is : ". $Rev;
                    echo "<br>";
                    echo "Transcription is : ". $Trans;
                } else {
                    echo "<h3>Failed to insert</h3>";
                }
            }
}

and this is my HTML

<form action="action.php" target="_blank" mathod="POST">
   <p>GC</p>
   <p id="result1" name="result1"></p>
   <br>
   <p>Complement</p>
   <p id="result2" name="result2"></p>
   <br>
   <p>Transcripe</p>
   <p id="result3" name="result3"></p>
   <br>
   <p>Reverse Complement</p>
   <p id="result4" name="result4"></p>
</form>

so how can I read these paragraphs to insert its data into database



source https://stackoverflow.com/questions/67942296/get-text-wrote-in-html-paragraph-using-php

No comments:

Post a Comment