I will try to explain this the best way I can.
I have a page cars.php that displays results from a mysql table. Here is the php code that returns these results.
<?php while ($row1 = mysql_fetch_array($query1)) {
echo '<div class="items">';
echo "<a class='cars' href=\"item.php?id={$row1['id']}\"><img src={$row1['cars_img']} width='250px' height='250px'></a>";
echo '</div>';
echo '<div class="caption">';
echo $row1['car_name'];
echo '</div>';
echo '<div class="send">';
echo "<a href=\"text.php?id={$row1['id']}\">Send</a>";
echo '</div>';
?>
This returns a bunch of thumbnail images, captions, and a hyperlink "SEND" next to each result returned.
When I click SEND, it points to TEXT.PHP which sends a text message using a service called TextMagic. It's essentially returning results in php and uses a TextMagic include to communicate with the service. Here is the contents of TEXT.PHP...
<html>
<head>
<?php include('textmagic-sms-api-php/TextMagicAPI.php');?>
</head>
<?php
//Establishing Connection with Server
$connection = mysql_connect("localhost", "cars", "cars");
//Selecting Database
$db = mysql_select_db("cars", $connection);
?>
<?php
if (isset($_GET['id'])) {
$id = $_GET['id'];
$query1 = mysql_query("SELECT * FROM tbl_cars WHERE tbl_cars.id = '$id'", $connection);
?>
<body>
<?php
$api = new TextMagicAPI(array(
"username" => "my.username",
"password" => "password"
));
while ($row1 = mysql_fetch_array($query1)) {
$text = $row1['client_name'] . "-" . $row1['phone']
// Use this number for testing purposes. This is absolutely free.
$phones = array(17033005129);
$results = $api->send($text, $phones, true);
}}?>
</body>
</html>
The text message that gets sent contains the client name and phone number as you can see from the code...
$text = $row1['client_name'] . "-" . $row1['phone']
And it sends it to the phone number listed in the $phones variable
$phones = array(17033005129);
What I am trying to do (that has been frustrating me to no end) is instead of using the static phone number within the $phones variable, I would like the user to enter their phone number in an input field that the $phones variable will use.
So when someone clicks SEND, instead of just sending text to 17033005129, it pops up a windows or modal that asks user for their own cell phone number. Then the TEXT.php gets that number somehow and throws it in the $phones variable.
Any help would be really appreciated.