Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,
PHP
<?php
$cols=4;		
echo "<table>";
	do{
		echo "<tr>";
		for($i=1;$i<=$cols;$i++){
			$row=mysql_fetch_array($query_for_result);
			if($row){
				$f1=$row["reg_id"];
$f2=$row["name"];
$f3=$row["candi_pic_1"];
$f4=$row["name"];
$f5=$row["religion"];
$f6=$row["city"];
$f7=$row["state"];
$f8=$row["email_id"];
$f9=$row["age"];
$f10=$row["height"];
$f11=$row["city"];
$f12=$row["education"];

				
				
				
 ?>
        <td >
            <table>
                <tr valign="top">
                
                <td  width="22" valign="top"  > </td>
                
                <td ></td>
                       </tr>
                       
                       <tr valign="top">
                       <td  width="22" valign="top"  > <input id="row" value="<?php echo htmlentities($row);?>" type="hidden" /></td>
                <td  width="150" valign="top" >MMJS Id: <?php echo $f1;?><br/>Name: <?php echo $f2; ?><br />Age:<?php echo $f9; ?><br/>Education: <?php echo $f12; ?> <br /> city: <?php echo $f11; ?><br/><a  href="profile-page.php?reg_id=<?php echo $f1; ?>" class="red-more" target="_blank" id="payment">View Full Profile</a></td>

                       </tr>
           </table>
        </td>
<?php
			}
			else{
				echo "<td> </td>";
			}
		}
	} while($row);
	echo "</table>"; }
else {
echo "<script> alert('No Data Found')</script>";
}
?>

Here i want to show a msg on View full profile button click and validate its clicked functionality with some condition.
I put but its not working for every value , its working for only first value,
if any of you have any suggestion and idea please share.
Code coulde be in PHP, JAVASCRIPT or JQUERY..
Thanks
Posted

Replace following line -
HTML
<a href="profile-page.php?reg_id=<?php echo $f1; ?>" class="red-more" target="_blank" id="payment">View Full Profile</a>

with this one -
HTML
<a href="profile-page.php?reg_id=<?php echo $f1; ?>" onclick="return validateProfile('<?php echo $f1; ?>')" class="red-more" target="_blank" id="payment">View Full Profile</a>


Then add a JavaScript block as shown below -
JavaScript
function validateProfile(reg_id) {
  var isValid = false;
  // your validation code goes here which will set isValid to true on success
  return isValid;
}


Regards,
Niral Soni
 
Share this answer
 
Comments
[no name] 12-Mar-13 4:52am    
Thanks I have use you Code for reference. I did the same but not work for what i looking for.
JavaScript
function validateProfile() {

var mode =document.getElementById("payment_mode").value;

if(mode=="No")
{
alert("Please Pay the Amount First!");
return false;
}
  
}


HTML
<input id="payment_mode" value="<?php echo htmlentities($payment_mode);?>" type="hidden" />
<a href="profile-page.php?reg_id=<?php echo $f1; ?>" class="red-more" target="_blank" onclick="return validateProfile()">View Full Profile</a>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900