Question

So hi guys. I have a problem regarding a variable passing. I can't explain it clearly but here's the code. I know it'll be clearer with this.

    <tbody>
    <tr>
    <td><?php echo $row['nameSchool'] ?></td>
    <td><?php echo $row['address'] ?></td>
    <td><?php echo $row['honor'] ?></td>
    <td><?php echo $row['year'] ?></td>
    <td width = "5%"><div id='basic-modal-2'><a href="?idnum = <?php echo $row['countr']; ?>" title = "Edit" class = "basic"><img src="../img/edit.png" height="22" width="22"></a></div></td>
    <td><a href="#" title = "Delete"><img src="../img/Delete.png" height="22" width="22"></a></td>
    </tr>
<?php
        }
?>
    </tbody>

   //some codes here.

<!-- Update Employee -->
<div id="basic-modal-content-2">
    <h3>Update Information</h3>
    <p></p>
    </br>
    <form method="post" action="add3.php">
        <table id = "box-table-c2" class = "basic-modal-content-2">
            <thead></thead>
            <tbody>
                <tr>
                    <td><strong><?php echo $_GET['idnum']; ?></strong></td>
                    <td>:</td>
                    <td><input type="text" class="input-xlarge" name = "NS"></td>
                </tr>
                <tr>
                    <td><strong>Address</strong></td>
                    <td>:</td>
                    <td><input type="text" class="input-xlarge" name = "ad"></td>
                </tr>
                <tr>
                    <td><strong>Honors Received</strong></td>
                    <td>:</td>
                    <td><input type="text" class="input-xlarge" name = "HR"></td>
                </tr>
                <tr>
                    <td><strong>Year Graduated</strong></td>
                    <td>:</td>
                    <td><input type="text" class="input-xlarge" name = "YG"></td>
                </tr>
                <tr>
                    <td align= "left" width= "3"><button class="btn-primary" type="submit" style = "cursor: pointer";>Submit</button></td>
                </tr>
            </tbody>
        </table>
    </form>
</div>

They are both on the the same php file (educinfo.php)

My error is that i can't pass the value of the "EDIT" link to the simplemodal.

Thank You guys.

Was it helpful?

Solution

You can pass value in PHP using many ways. one way is passing value in Query String. That is you can pass value after file name with question mark. just like key value passing

phpfilename.php?key1=value1&key2=value2

You can pass any number of key and value. After that you can access in next page using key value.

In HTML Part:

<a href="filename.php?QueryString=valueOne" title = "Edit" class = "basic">
     <img src="../img/edit.png" height="22" width="22">
</a>

In php you can get like this

$Idvalue = isset($_GET['QueryString']) ? $_GET['QueryString'] : "";

Please let me know if you have any issue for passing value like this

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top