Trevor Posted March 5, 2013 Share Posted March 5, 2013 I am trying to get a echo in PHP to print in a table i have created on the same page. This is my current coding <?php$con = mysql_connect("localhost","****","****");if (!$con){die('Could not connect: ' . mysql_error());}mysql_select_db("****", $con);$result = mysql_query("SELECT * FROM membersWHERE member_msisdn='$slusername'");echo "<table border='1'><tr><th>Membership</th><th>Number</th><th>Registration Date</th><th>End Date</th><th>Copy of ID</th></tr>";while($row = mysql_fetch_array($result)){echo "<td><center>" . $row['member_id'] . "</td>";echo "<td><font color=blue>" . $row['member_msisdn'] . "</td>";echo "<td><center>" . $row['asdate'] . "</td>";echo "<td><center>" . $row['aedate'] . "</td>";echo "<td><center>" . $row['attid'] . "</td>";echo "</tr>";}echo "</table>";mysql_close($con);?></div><div class="Notes"><strong><br>Emergency Contact Numbers:</strong><br><?php$con = mysql_connect("localhost","****","****");if (!$con){die('Could not connect: ' . mysql_error());}mysql_select_db("****", $con);$result = mysql_query("SELECT * FROM members a INNER JOIN recipients b ON a.member_id =b.member_id WHERE member_msisdn=$slusername");echo "<table border='1'><tr><th>Number</th><th>Name</th><th>Surname</th></tr>";while($row = mysql_fetch_array($result)){echo "<td><font color=blue>" . $row['recipient_msisdn'] . "</td>";echo "<td>" . $row['recipient_name'] . "</td>";echo "<td>" . $row['recipient_surname'] . "</td>";echo "</tr>";}echo "</table>";mysql_close($con);?></div><p><label for="member_id"></label><input type="text" name="member_id" id="member_id"> // here i need the member_id of members to be printed so i can have it entered into another table on same sql DB</p><p><br></p></div></td> Basically i need the to print or past it in the input that it will use it later on a different table in the SQL DB Link to comment https://forums.phpfreaks.com/topic/275291-php-and-sql-help/ Share on other sites More sharing options...
davidannis Posted March 6, 2013 Share Posted March 6, 2013 I'm not understanding the question but I know that you need a <form action="somethingToDoWithTheInput.php" method="POST"> before the input and a submit and /form after it. If you wnat to prepopulate the input you need to do something like: <input type="text" name="member_id" value="<?php echo $mydata['name'];?>" id="member_id"> Does that help? David Link to comment https://forums.phpfreaks.com/topic/275291-php-and-sql-help/#findComment-1416852 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.