I have this page admin_inquiry.php(page1) which has a dynamic table that shows rows of records.I want to get the values from 2 columns, ContactNo, and message. The contactno column contains a link, which goes to admin_sms.php(page2) and displays the contact no in a textfield.
page1:
<td><a href="admin_sms.php?ContactNo=<?php echo $row_ContactUs['ContactNo']; ?>">Send SMS</a></td>
page2:
<input name='number' type='text' id="number" value="<?php if(isset($_GET['ContactNo'])){echo $_GET['ContactNo'];}else{echo "";}?>">
I also want to get the content of column message from the 1st page and show it in a textarea in page 2. But it should show the message the belongs to particular id or something. I heard of sessions but I don't quite get it yet. Could you show me how?
UPDATE I tried this in the admin_inquiry.php
$_SESSION['message'] = $row_ContactUs['message'];
admin_sms.php
$_SESSION['message'];
<textarea name="frmMsg" id="frmMsg" cols="45" rows="5"><?php echo $_SESSION['message'];?></textarea>
The problem is, it's showing the same message. Not the corresponding message that belongs to a certain id or something.Help me please.
If you are still having problems solving this, in your table include a
html form
UPDATE including pagination
first solution, create a file and call it contact.php
create a pagination.php file
create a css file admin.css
admin_iquiry.php file
admin_sms.php
html code
Second solution using
$_GET
admin_sms.php
in your html
Approach 1 :
Use the
POST
method to submit the form. That way, you can query the Message element, pertaining the Contact No., depending on what name or Id you have given to the<td>
elements. (you have not given any yet).Approach 2 :
Set the href property of the contact No. element dynamically, using, say
jQuery
. Set the action attribute to a URL that includes both the ContactNo and Message asURL parameters
. That way you can access the message also from theGET
array just as you are doing with the Contact No. (Note : Not sure if long texts like message can be passed on as URL parameters, depends on the length, and may be security issues).