phonebook

A

Anonymous

Guest
hello guys..can anyone help me explain about on how to make the phonebook feature to be included into the system..??is it using javascript or php??
 
hi guys..i've already design the phonebook page which known as phonebook.php....i've get the sample from the net..it works well but when i click the "use address" button, there is nothing appear in the sms_form.php (i mean on the textfield for the phone number)...can anybody help me?? :help:
 
by the way..below is my codes:

********************phonebook.php**************************

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?
include ("db_connect.php");;
?>

<p> </p>
<form action="sms_form.php" method="post">
<table align="center" width="720">
<tr>
<td width="720" align="center" bgcolor="#DCDCDC"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Personal
Address Book</font></strong></td>
</tr>
</table>

<div align="center">
<table align="center" border="0" cellpadding="1" cellspacing="0" width="720">
<tr>
<td width="200" align="center" bgcolor="#FFFFCC"><div align="left"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Select</font></strong></div></td>
<td width="200" align="center" bgcolor="#FFFFCC"><div align="left"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Name</font></strong></div></td>
<td width="180" align="center" bgcolor="#FFFFCC"><div align="left"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Mobile
Number</font></strong></div></td>
<td width="140" align="center" bgcolor="#FFFFCC"><div align="left"><strong></strong></div></td>
</tr>
<?php
$query = "Select * FROM phonebook;"; //where Groupname=$Groupname;";
$result = mysql_query($query);

while ($row = mysql_fetch_array($result))
{
$id = $row["id"];
$name = $row["name"];
$phone = $row["no"];

?>
<tr>
<td width="200">
<div align="left">
<?
echo "<input name='zon2[]' type='checkbox' value='$phone'>";
echo "<strong><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>";
echo $id;

?></div></td>
<td width="200"><div align="left"><span class="style1 style2"><? echo $name; ?></span></div></td>
<td width="180"><div align="left"><span class="style1 style2"><? echo $phone; ?></span></div></td>

<td width="140" height="20" colspan="2" ><div align="right"><?
echo "<a href='edit.php?id=$id'>edit</a>::<a href='delete.php?id=$id' onClick=\"return confirm('Are you sure?')\">delete</a>"; echo "<br>";
echo "</font></strong>";
?> </div></td></tr>
<? } ?>

</table>
</div>
</FORM>
<h4><center>
<form action="sms_form.php" method="post">
<table border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td><p align="center"><input type="Submit" value="Use Addresses" name="submit" ></p></td>
</tr>
</table>
</form>

<p> </p>
</body>
</html>




****************************sms_form.php*****************************
<html>

<body bgcolor="#2B547E">
<form method="post" action="sendsmsscript.php">
<p> </p><table width="600" border="0" align="center" bordercolor="#003300" bgcolor="#488AC7">
<td height="350">
<table width="80%" border="1" align="center" bordercolor="#003300" bgcolor="#488AC7">
<tr bgcolor="#2B547E">
<td height="45" colspan="2"><div align="center"><font color="#CCCCCC" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>SEND
SMS TO TECHNICIAN</strong></font></div></td>
</tr>
<tr>
<td width="145"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Mobile
Number</strong></font></td>
<td width="325"> <div align="justify">
<input type="text" name="no" value="<?php echo $phone;?>" size="12" maxlength="12" <?php if($phone !="") echo"readonly"?>/>
<strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="phonebook.php">phonebook</a></font></strong></div></td>
</tr>
<tr>
<td valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Text
Message</strong></font></td>
<td><textarea name="text" cols="40" rows="5"></textarea> </tr>
<tr bgcolor="#2B547E">
<td colspan="2" align="center"> <input type="submit" value="Send SMS">
<input type="reset" name="Reset" value="Clear"> </td>
</tr>
</table>
</table>
</form>
</BODY>
</HTML>
 
Try using:
Code:
<?php

// This
$_POST['phone'];

// Instead of:
$phone;

// Also you have an error in this line:
<?php if($phone !="") echo"readonly"?> 
The ; at last.

?>
And is your $phone variable been printed/outputed in the first form ?
BTW: Do you have register_globals = on ? You should have it off for security reasons.
 
yess..the $phone value should be displayed in the sms_form after has been checked in the phonebook.php...but it still not display int the form... :( wat should i do ??
 
i've tried it but the $phone still not appear in the form..actually.where exactly should i put your code below:

// This
$_POST['phone'];

// Instead of:
$phone;

in the phonebook.php or sms_form.php?
 
Actualy you don't have to use it. Now i see.
The value of your $phone variable sent to the sms_form.php file is inside the zon2 array.

I guess you need something like the next. Test it first, like it is, to see what you get.
Use it in your sms_form.php file:
Code:
<?php

// From your phonebook.php form
if(array_key_exists('submit', $_POST) && !empty($_POST['submit'])){     
     foreach($_POST['zon2'] as $key => $value){  
          // For test purposes only
          print $key . ' = ' . $value;
     }
}

?>
 
Back
Top