Hi. I am having much trouble with a code.
I have a form where you update your profile. But is asking me to enter the phone, but at registration I did not ask the phone numbers.
Please big help. Thank you.
2 files:
1 - myprofile.php wich has this... refering to my problem
Code:
$country=$row[country];
$code=$row[pin_code];
//$primary2=$row[home_phone];
$primary=explode("-",$row[home_phone]);
$primary1=$primary[0];
$primary2=$primary[1];
$primary=$primary[2];
/*$pri_count=strlen($primary2);
$primary1=substr($primary2, 0, 3);
$primary=substr($primary2, 3, $pri_count); */
//$secondary2=$row[work_phone];
$secondary_phone=explode("-",$row[work_phone]);
$secondary1=$secondary_phone[0];
$secondary=$secondary_phone[1];
$zipcode=$row[pin_code];
$country=$row[country];
/*$sec_count=strlen($secondary2);
$secondary1=substr($secondary2, 0, 3);
$secondary=substr($secondary2, 3,$sec_count); */
$email=$row[email];
...
$primary=$_POST[txtprimary];
$primary1=$_POST[txtprimary1];
$primary2=$_POST[txtprimary2];
$secondary=$_POST[txtsecondary];
$secondary1=$_POST[txtsecondary1];
...
if(empty($primary))
{
$err_primary="please enter info";
$err_flag=1;
}
if((strlen($primary)<6) || !is_numeric($primary))
{
$err_primary="Phoneno incorect";
$err_flag=1;
}
if(empty($primary1))
{
$err_primary="please enter info";
$err_flag=1;
}
if((strlen($primary1)<2) || !is_numeric($primary1))
{
$err_primary="Phoneno primar incorect";
$err_flag=1;
}
if(empty($primary2))
{
$err_primary="please enter info";
$err_flag=1;
}
if((strlen($primary2)<2) || !is_numeric($primary2))
{
$err_primary="Phoneno primar incorect";
$err_flag=1;
}
if(empty($secondary))
{
$err_secondary="please enter info";
$err_flag=1;
}
if(strlen($secondary)<7 || !is_numeric($secondary))
{
$err_secondary="Secundar Phoneno not valid";
$err_flag=1;
}
if(empty($secondary1))
{
$err_secondary="please enter info";
$err_flag=1;
}
if(strlen($secondary1)<3 || !is_numeric($secondary1))
{
$err_secondary="Secundar Phoneno not valid";
$err_flag=1;
...
$sql.="city='$city',state='$state',country='$country',pin_code='$zipcode',home_phone='$primary',";
$sql.=" work_phone='$secondary',email='$reemail',html_profile ='$html_profile' where user_id=".$_SESSION['userid'];
..
and
myprofile.tpl
Quote:
<? if(!empty($err_primary))
{
?>
<tr><td> </td><td class="detail9txtnormal"><a href="myprofile.php#txtprimary" class="header_text2">
Telefon fix</a> - <?= $err_primary; ?></td></tr>
<?
}
?>
<? if(!empty($err_secondary))
{
?>
<tr><td> </td><td class="detail9txtnormal"><a href="myprofile.php#txtsecondary" class="header_text2">
mobil phone</a> - <?= $err_secondary; ?></td></tr>
<?
}
?>
.... <tr><td class="detail9txt">
<!-- <? if(!empty($err_primary))
{
?>
<img src="http://www.000webhost.com/forum/images/warning_9x10.gif"> <font color=red><?= $err_primary ?></font>
<br>
<b><font color="red" size="2">home phone</font></b>
<?
}
else
{
?> -->
<b><font size="2">home phone</font></b>
<!-- <?
}
?> -->
</td>
<td class="detail9txt">
<!-- <? if(!empty($err_secondary))
{?>
<img src="http://www.000webhost.com/forum/images/warning_9x10.gif"> <font color=red><?= $err_secondary ; ?></font>
<br>
<b><font size=2 color=red>mobile phone</font></b>
<?
}
else
{
?> -->
<b><font size=2>mobile phone</font></b>
<!-- <?
}
?> -->
</td>
</tr>
<tr align="left"><td>
<input type="text" name="txtprimary" class="txtsmall" value="<?=$primary?>" maxlength="10" size="15" onBlur="numchk(this);" onKeyPress="numchk(this);" onKeyDown="numchk(this);" onKeyUp="numchk(this);" /></td>
<td>
<input type="text" name="txtsecondary" class="txtsmall" value="<?= $secondary; ?>" maxlength="10" size="15">
</td></tr>
|