I have one payment page where payment values will fill automatically . so i don't want allow that page to user to submit . how can i do auto submit of my page ?
my code is
include "configaration/config.php";
// Merchant key here as provided by Payu
$MERCHANT_KEY = "4LbrUG";
// Merchant Salt as provided by Payu
$SALT = "EhDp06FA";
// End point - change to https://secure.payu.in for LIVE mode
$PAYU_BASE_URL = "https://test.payu.in";
$sucess_url = 'http://localhost/georamble/success.php';
$failur_url = 'http://localhost/georamble/failure.php';
$action = '';
$posted = array();
if(!empty($_POST)) {
foreach($_POST as $key => $value) {
$posted[$key] = $value;
}
}
$formError = 0;
if(empty($posted['txnid'])) {
// Generate random transaction id
$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
} else {
$txnid = $posted['txnid'];
}
$hash = '';
// Hash Sequence
$hashSequence = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";
if(empty($posted['hash']) && sizeof($posted) > 0) {
if(
empty($posted['key'])
|| empty($posted['txnid'])
|| empty($posted['amount'])
|| empty($posted['firstname'])
|| empty($posted['email'])
|| empty($posted['phone'])
|| empty($posted['productinfo'])
|| empty($posted['surl'])
|| empty($posted['furl'])
|| empty($posted['service_provider'])
) {
$formError = 1;
} else {
//$posted['productinfo'] = json_encode(json_decode('[{"name":"tutionfee","description":"","value":"500","isRequired":"false"},{"name":"developmentfee","description":"monthly tution fee","value":"1500","isRequired":"false"}]'));
$hashVarsSeq = explode('|', $hashSequence);
$hash_string = '';
foreach($hashVarsSeq as $hash_var) {
$hash_string .= isset($posted[$hash_var]) ? $posted[$hash_var] : '';
$hash_string .= '|';
}
$hash_string .= $SALT;
$hash = strtolower(hash('sha512', $hash_string));
$action = $PAYU_BASE_URL . '/_payment';
}
} elseif(!empty($posted['hash'])) {
$hash = $posted['hash'];
$action = $PAYU_BASE_URL . '/_payment';
}
//data from previous page
if(isset($_POST['submit1']))
{
$packname = $_POST['pname'];
$package_price = $_POST['advn_pay'];
$person = $_POST['person'];
$date = $_POST['date'];
$date = date('Y-m-d', strtotime($date));
$package_id = $_POST['pkid'];
$wallet_amount = $_POST['wallet_amount'];
$wallet_amount_use = 0;
if(isset($_POST['wuamount']))
{
$wallet_amount_use = $_POST['wuamount'];
}
$ref_no =rand(20,10000000);
$pay_status = "unpaid";
$req_status = "requested";
$wallet_update_money= $wallet_amount - $wallet_amount_use;
$update= mysql_query("UPDATE wallet SET amount='$wallet_update_money' WHERE user_id='$login_session'");
//fetch a user name
$query = mysql_query("select * from user where user_id= '$login_session'");
if(!$query)
{
echo "error";
}
while($row=mysql_fetch_array($query))
{
$name = $row['first_name'];
$email = $row['email'];
$contact_number = $row['contact_number'];
}
$p_name=$_POST['name'];
$age=$_POST['age'];
for($i=0;$i<count($p_name);$i++)
{
$qry_add="INSERT INTO trvel_person_details (ref_user_id,ref_cus_name,cus_name,cus_age,travel_date)
VALUES ('$login_session', '$name','$p_name[$i] ','$age[$i]','$date')";
if(!mysql_query($qry_add))
{
die('Error: ' . mysql_error());
}
}
$total_amount= $package_price - $wallet_amount_use ; //total amount
$qry="INSERT INTO pack_req (user_id,user_name,package_id,pacakage_name,amount,date_jrny,no_person,refrence_number,payment_status,req_status)
VALUES ('$login_session', '$name','$package_id ','$packname','$total_amount','$date ','$person','$ref_no','$pay_status ','$req_status')";
if(!mysql_query($qry))
{
die('Error: ' . mysql_error());
}
}
?>
<html>
<head>
<script>
var hash = '<?php echo $hash ?>';
function submitPayuForm() {
if(hash == '') {
return;
}
var payuForm = document.forms.payuForm;
payuForm.submit();
}
</script>
</head>
<body onload="submitPayuForm()">
<h2>PayU Form</h2>
<br/>
<?php if($formError) { ?>
<span style="color:red">Please fill all mandatory fields.</span>
<br/>
<br/>
<?php } ?>
<form action="<?php echo $action; ?>" method="post" id="payuForm" name="payuForm">
<input type="hidden" name="key" value="<?php echo $MERCHANT_KEY ?>" />
<input type="hidden" name="hash" value="<?php echo $hash ?>"/>
<input type="hidden" name="txnid" value="<?php echo $txnid ?>" />
<table>
<tr>
<td><b>Mandatory Parameters</b></td>
</tr>
<tr>
<td>Amount: </td>
<td><input name="amount" id="amount" value="<?php echo (empty($posted['amount'])) ? $total_amount : $posted['amount']; ?>" /></td>
<td>First Name: </td>
<td><input name="firstname" id="firstname" value="<?php echo (empty($posted['firstname'])) ? $name : $posted['firstname']; ?>" /></td>
</tr>
<tr>
<td>Email: </td>
<td><input name="email" id="email" value="<?php echo (empty($posted['email'])) ? $email : $posted['email']; ?>" /></td>
<td>Phone: </td>
<td><input name="phone" value="<?php echo (empty($posted['phone'])) ? $contact_number : $posted['phone']; ?>" /></td>
<td>transation Id: </td>
<td><input name="txnid" value="<?php echo (empty($posted['txnid'])) ? $ref_no : $posted['txnid']; ?>" /></td>
</tr>
<tr>
<td>Product Info: </td>
<td colspan="3"><textarea name="productinfo"><?php echo (empty($posted['productinfo'])) ? $packname : $posted['productinfo'] ?></textarea></td>
</tr>
<tr>
<td>Success URI: </td>
<td colspan="3"><input name="surl" value="<?php echo (empty($posted['surl'])) ? $sucess_url : $posted['surl'] ?>" size="64" /></td>
</tr>
<tr>
<td>Failure URI: </td>
<td colspan="3"><input name="furl" value="<?php echo (empty($posted['furl'])) ? $failur_url : $posted['furl'] ?>" size="64" /></td>
</tr>
<tr>
<td colspan="3"><input type="hidden" name="service_provider" value="payu_paisa" size="64" /></td>
</tr>
<?php if(!$hash) { ?>
<td colspan="4"><input type="submit" value="Submit" /></td>
<?php } ?>
</tr>
</table>
</form>
even i have tried with one javascript to auto submit the form
<script type="text/javascript">
$(document).ready(function(){
$("#payuForm").submit();
});
</script>
but still its not redirecting . how can do this . any hint or help . sorry for my bad english
Create a hidden submit type button(i.e. display:none;), after page load through jquery click on it automatically(i.e. $('#submit').click() ), Create a function for clicking on submit button, call it after page loads...
EDIT:
HTML:
<form ...>
...
<input type="submit" id="submit" style="display:none;" />
</form>
Javascript:
function submit_click(){
$("#submit").click();
}
Now, when your auto form populating data's function called, call this function in last line submit_click();
try this
<script>
$(document).ready(function(){
$('#payuForm').trigger('submit');
})
</script>
Remember that some browser do not let you trigger the "submit" event if you have not an ENABLED submit button (be it an input or button, with type="submit")
Thus, you need to a button in the form, and if you don't want it to be shown, you can add
#button {
display: none;
visibility: hidden;
}
Related
I have contacted godaddy and everything looks good on their end. This code works on my localhost when using xampp but not when uploaded on cpanel. MYSQL works. I am using sessions only to make the "add to cart" button work. When I click the button it refreshes but doesn't add anything to cart. Do I also have to use cookies? If I do then how can I add it to this code?
<?php
session_start();
$connect = mysqli_connect( "localhost", "username", "pass", "");
if(isset($_POST["add_to_cart"]))
{
if(isset($_SESSION["shopping_cart"]))
{
$item_array_id = array_column($_SESSION["shopping_cart"], "item_id");
if(!in_array($_GET["id"], $item_array_id))
{
$count = count($_SESSION["shopping_cart"]);
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][$count] = $item_array;
}
else
{
echo '<script>alert("Item Already Added")</script>';
}
}
else
{
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][0] = $item_array;
}
}
if(isset($_GET["action"]))
{
if($_GET["action"] == "delete")
{
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
if($values["item_id"] == $_GET["id"])
{
unset($_SESSION["shopping_cart"][$keys]);
echo '<script>alert("Item Removed")</script>';
echo '<script>window.location="mysqlcart.php"</script>';
}
}
}
}
?>
<?php
if(!empty($_SESSION["shopping_cart"]))
{
$total = 0;
$return = [];
foreach($_SESSION["shopping_cart"] as $keys => $values) {
?>
<tr>
<td><?php echo $values["item_name"]; ?></td>
<td><?php echo $values["item_quantity"]; ?></td>
<td>$ <?php echo $values["item_price"]; ?></td>
<td>$ <?php echo number_format($values["item_quantity"] * $values["item_price"], 2);?></td>
<td><span class="text-danger">Remove</span></td>
</tr>
<?php
$total = $total + ($values["item_quantity"] * $values["item_price"]);
$return[] = $values["item_quantity"];
$return[] = $values["item_name"];
}
?>
<?php
}
?>
<?php
$query = "SELECT * FROM tbl_product.tbl_product ORDER BY id ASC";
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
?>
<form method="post" action="mysqlcart.php?action=add&id=<?php echo $row["id"]; ?>">
<input type="text" name="quantity" value="1" class="form-control" />
<input type="hidden" name="hidden_name" value="<?php echo $row["name"]; ?>" />
<input type="hidden" name="hidden_price" value="<?php echo $row["price"]; ?>" />
<input type="submit" name="add_to_cart" style="margin-top:5px;" class="btn btn-success" value="Add to Cart" />
</form>
<?php
}
}
?>
I have a div at index.php which i want to refresh as the ajax call succeeds. I tried this. But it is not refreshing the div unless i refresh the whole page.
here is the code.
Div
<div id="cartContainer">
<div id="cart">
<li style="color: #515151">
<img id="cart_img" src="images/cart.png"> Cart <span class='badge' id='comparison-count'>
<?php
if(isset($_SESSION['cart'])&& !empty($_SESSION['cart']))
{
$cart_count=count($_SESSION['cart']);
echo $cart_count;
} else {
$cart_count=0;
echo $cart_count;
}
?>
</span>
</li>
<div id="sidebar">
<?php if(isset($_SESSION[ 'cart'])&& !empty($_SESSION[ 'cart'])){ ?>
<table id="s_table">
<?php foreach($_SESSION[ 'cart'] as $id=> $value){ ?>
<form class="product" method="get" action="index.php?">
<tr id="tr_s">
<input type="hidden" name="action" value="remove">
<input type="hidden" name="id" value="<?php echo $value['id'] ?>">
<td class="s_th">
<?php echo $value[ 'name']; ?>
<input type="hidden" name="name" value="<?php echo $value['name'] ?>">
</td>
<td class="s_th">
<?php echo $value[ 'quantity'] ?>
<input type="hidden" name="quantity" value="<?php echo $value['quantity'] ?>">
</td>
<td class="s_th">
<?php echo $value[ 'color']; ?>
<input type="hidden" name="color" value="<?php echo $value['color'] ?>">
</td>
<td class="s_th">
<?php echo $value[ 'size'] ?>
<input type="hidden" name="size" value="<?php echo $value['size'] ?>">
</td>
<td>
<button type="submit" id="btn_submit">Remove</button>
</td>
</tr>
</form>
<?php } ?>
<tr>
<td class="cart_btn" colspan="2">GO TO CART
</td>
<td class="cart_btn" colspan="2">CHECK OUT
</td>
</tr>
</table>
<?php } else { ?>
<p id="p_s"><i> "Your Cart is Empty"</i>
</p>
<?php } ?>
</div>
</div>
</div>
Ajax
<script>
$(document).ready(function() {
$('#addtocart').click(function(e) {
e.preventDefault();
var page = $("#page").val(),
action = $("#action").val(),
name = $("#name").val(),
id = $("#id").val(),
color = $("#color").val(),
size = $("#size").val(),
cat_id = $("#cat_id").val(),
s_cat_id = $("#s_cat_id").val(),
category = $("#category").val();
var proceed = true;
if (proceed) {
post_data = {
'Page': page,
'Action': action,
'Name': name,
'Cat_id': cat_id,
'S_cat_id': s_cat_id,
'Category': category,
'Id': id,
'Color': color,
'Size': size
};
$.post('add_cart.php', post_data, function(response) {
//load json data from server and output message
if (response.type == 'error') {
//output=$('.alert-error').html(response.text);
} else {
output = $("#cartContainer").load();
}
$(".alert-error").delay(3200).fadeOut(300);
}, 'json');
}
});
});
</script>
If you want to update the div with the return from you AJAX you would do something like this:
$.post('add_cart.php', post_data, function(response) {
$("#cartContainer").html(response);
}
Of course this depends on many things: the kind of data you're returning, what you wish to update, etc. It is hard to tell, from what you have posted, what your intent is.
My php code is as follows
<?php
if (isset($_POST["pitcode"]))
{
echo $_POST['pitcode'];
$pnetamt=0;
foreach ($_POST['txtwono1'] as $k => $v)
{
$pitcode=$_POST['pitcode'][$k];
$m_no=0;
$sql = mysql_query("select itrate from ITMAST where itcode='$pitcode'") or die(mysql_error());
$row = mysql_fetch_array($sql) or die(mysql_error());
$m_no = mysql_num_rows($sql);
if ($m_no!=0)
{
$sql = mysql_query("select itrate from ITMAST where itcode='$pitcode'") or die(mysql_error());
$row = mysql_fetch_row($sql);
$prate=$row[0];
}
}
}
?>
Javascript code is
<script type='text/javascript'>
function getitemcode()
{
var model=$('#itname').val();
document.frmwo.getElementById("txtitcode").value = model;
}
</script>
and HTML is
<html>
<td><input type="text" maxlength="3" size="2" name="txtwono1[]" class="rightJustified" value="<?php echo $pwono1; ?>"/></td>
<td><input type="text" maxlength="2" size="2" name="txtsno[]" class="rightJustified" value="<?php echo $psno; ?>"/></td>
<td>
<?php
$sql = "SELECT itcode,itname FROM ITMAST ";
$result = mysql_query($sql) or die(mysql_error());
echo "<select name='itname[]' id='itname' onchange='getitemcode()'>";
while ($row = mysql_fetch_array($result))
{
echo "<option value = '{$row['itcode']}'";
if ($pitcode == $row['itcode'])
echo "selected = 'selected'";
echo ">{$row['itname']}</option>";
}
echo "</select>";
?>
</td>
<td><input type="text" maxlength="8" size="8" name="txtitcode" id='txtitcode' class="rightJustified" value="<?php echo $pitcode; ?>"/></td>
<td><input type="text" maxlength="8" size="8" name="txtqty[]" class="rightJustified" onchange="calcitemamt()" value="<?php echo $pqty; ?>"/></td>
<td><input type="text" maxlength="6" size="6" name="txtrate[]" class="rightJustified" disabled="disabled" value="<?php echo $prate; ?>"/></td>
<td><input type="text" maxlength="7" size="7" name="txtamt[]" disabled="disabled" class="rightJustified" value="<?php echo $pamt; ?>"/></td>
</html>
My Problem is when I selects the Item from Combo, its value is not passed to php code from where I am getting price of that item and that price should come to in rate column. This should work for all rows of html table - How
Change html code
echo "<select name='itname[]' id='itname' onchange='getitemcode()'>";
with
echo "<select name='itname[]' id='itname' onchange='getitemcode(this.value)'>";
also change javascript code
<script type='text/javascript'>
function getitemcode()
{
var model=$('#itname').val();
document.frmwo.getElementById("txtitcode").value = model;
}
</script>
with
<script type='text/javascript'>
function getitemcode(model)
{
document.frmwo.getElementById("txtitcode").value = model;
}
</script>
I need delete each row in html table using checkbox
Currently can delete row using link
I am using switch in my code in case delete query exist
Code php
<tr class="<?php if($i%2 == 0) { echo 'even'; } else { echo 'odd'; }
?>">
<td><div class="grid_content sno"><span><?php echo $i; ?>
</span> </div></td>
<td><div class="grid_content editable"><span><?php echo
$records['name_ar']; ?></span><input type="text"
class="gridder_input"
name="<?php echo encrypt("name_ar|".$records['id']); ?>"
value="<?php echo $records['name_ar']; ?>" /></div></td>
<td><div class="grid_content editable"><span>
<?php echo $records['name_en']; ?>
</span><input type="text" class="gridder_input"
name="<?php echo encrypt("name_en|".$records['id']); ?>"
value="<?php echo $records['name_en']; ?>" /></div></td>
<td>
<a href="<?php echo encrypt($records['id']); ?>"
class="gridder_delete"><img src="images/delete.png"
alt="Delete" title="Delete" /></a>
<input type="checkbox" name="delete[]"
value="<?php echo encrypt($records['id']); ?>" />
</td>
</tr>
case "delete":
$value = decrypt($_POST['value']);
$query = mssql_query("DELETE FROM Job_creation WHERE id = '$value' ");
break;
code ajax
// Function for delete the record
$('body').delegate('.gridder_delete', 'click', function(){
var conf = confirm('Are you sure want to delete this record?');
if(!conf) {
return false;
}
var ThisElement = $(this);
var UrlToPass = 'action=delete&value='+ThisElement.attr('href');
$.ajax({
url : 'ajax.php',
type : 'POST',
data : UrlToPass,
success: function() {
LoadGrid();
}
});
return false;
});
Many thanks in advance for those who help me :)
In a php application with I inherited (I am a php newbie) I have a php form with multiple includes. One of the includes has two tables set up and within each table is a form. The first form displays records retrieved from a MySQL database, so there could be 1 or more records returned. A while loop goes through the records and populates the controls with the data for each record (name, phone, email). The controls are named [fieldname<?php echo $line; ?>] - where $line starts at 1 and is incremented as the while loop goes through the records. This is working fine!
The problem comes when someone wants to edit one of the fields and submits the change. The form has an onsubmit="return validateForm(<?php echo $line; ?>);" I have checked to ensure that the $line variable does increment, but when it is sentto the javascript function "validateForm" the variable is not defined in the javasscript function. Originally I did I not pass the $line variable but the javascript function kept telling me that it could not get the value of the undefined element.
FIRST FORM CODE
<form action="admin_profiles_main_update.php" method="post" name="submit_order" enctype="multipart/form-data" onsubmit="return validateForm(<?php echo $line; ?>);">
<table border="0" cellspacing="0" cellpadding="0" class="forms">
<col width="20%"/>
<col width="80%"/>
<?php
if($user_access == 'National'){
$result = mysql_query("SELECT * FROM Profile ORDER BY profile_name");
}else{
$result = mysql_query("SELECT * FROM Profile WHERE profile_parent_region = '$user_profile' ORDER BY profile_name");
}
$line = 1;
while ($row_profile = mysql_fetch_array($result)){
$field_id = "_" . $line;
?>
<!-- LINE -->
<tr><td colspan="11"><hr class="view_line"></td></tr>
<!-- LINE -->
<tbody id="region<?php echo $field_id; ?>" >
<input class="field_long" name="profile_id<?php echo $field_id; ?>" id="profile_id<?php echo $field_id; ?>" type="hidden" value="<?php echo $row_profile[profile_id]; ?>"/>
<tr>
<td>
<label class="field_label" for="profile_parent_region<?php echo $field_id; ?>">Profile: </label>
</td>
<td align="left">
<select name="profile_parent_region<?php echo $field_id; ?>" id="profile_parent_region<?php echo $field_id; ?>" class="drop_med" >
<option></option>
<?php
if($user_access != 'National'){
$result_profile = mysql_query("Select Distinct profile_parent_region FROM profile where profile_parent_region = '$user_profile' ");
}else {
$result_profile = mysql_query("Select Distinct profile_parent_region FROM profile ORDER BY profile_parent_region ASC");
}
while($row = mysql_fetch_array($result_profile)){
echo '<option value ="'.$row['profile_parent_region'].'"';
if($row['profile_parent_region'] == $user_profile){
echo ' selected="selected"';
}
echo ' > ' . $row['profile_parent_region'] . '</option>';
}
?>
</select>
<span class="must_fill">* </span>
<label class="form_des" for="profile_parent_region<?php echo $field_id; ?>"></label>
</td>
</tr>
<tr>
<td>
<label class="field_label" for="profile_name<?php echo $field_id; ?>">Region: </label>
</td>
<td align="left">
<select name="profile_name<?php echo $field_id; ?>" id="profile_name<?php echo $field_id; ?>" class="drop_med" >
<option></option>
<?php
$parent_region = $row_profile['profile_name'];
if($user_access != 'National'){
$result_region = mysql_query("Select Distinct region FROM regions where parent_region = '$user_profile' ");
}else {
$result_region = mysql_query("Select Distinct region FROM regions ORDER BY region ASC");
}
while($row = mysql_fetch_array($result_region)){
echo '<option value ="'.$row['region'].'"';
if ($row['region'] == $parent_region){
echo ' selected="selected"';
}
echo ' >' . $row['region'] . '</option>';
}
?>
</select>
<span class="must_fill">* </span>
<label class="form_des" for="profile_name<?php echo $field_id; ?>"></label>
</td>
</tr>
<tr>
<td><label class="field_label" for="profile_manager<?php echo $field_id; ?>" >Region's Manager's Name: </label></td>
<td>
<input class="field_long" name="profile_manager<?php echo $field_id; ?>" id="profile_manager<?php echo $field_id; ?>" type="input" value="<?php echo $row_profile[profile_manager]; ?>"/>
<span class="must_fill">*</span>
<label class="form_des" for="profile_manager<?php echo $field_id; ?>"></label>
</td>
</tr>
<tr>
<td><label class="field_label" for="profile_phone<?php echo $field_id; ?>" >Region's Contact Number: </label></td>
<td>
<input class="field_long" name="profile_phone<?php echo $field_id; ?>" id="profile_phone<?php echo $field_id; ?>" type="input" value="<?php echo $row_profile[profile_phone]; ?>"/>
<span class="must_fill">*</span>
<label class="form_des" for="profile_phone<?php echo $field_id; ?>"></label>
</td>
</tr>
<tr>
<td><label class="field_label" for="profile_email<?php echo $field_id; ?>" >Region's Contact E-mail: </label></td>
<td>
<input class="field_long" name="profile_email<?php echo $field_id; ?>" id="profile_email<?php echo $field_id; ?>" type="input" value="<?php echo $row_profile[profile_email]; ?>"/>
<span class="must_fill">*</span>
<label class="form_des" for="profile_email">This email address will also be used to advise of files added to a submitted order.</label>
</td>
</tr>
<tr align="center">
<td colspan="2" class="loginrow">
<br />
<input name="Login <?php echo $field_id; ?>" id="Login<?php echo $field_id; ?>" value="Update Profile" type="submit" class="submit_button"/>
<br />
<br />
</td>
</tr>
</tbody>
<?php
$line++;
}
?>
</table>
</form>`
JAVASCRIPT FUNCTION - location in "parent" php form
function validateForm(lineNum) {
if (lineNum == null) {
var x = document.forms["submit_order"]["file_name"].value;
if (x == null || x == '') {
alert("Missing File Name.");
return false;
}
var x = document.forms["submit_order"]["file_for"].value;
if (x == null || x == '') {
alert("Missing File Type.");
return false;
}
var x = document.forms["submit_order"]["OrderForm"].value;
if (x == null || x == '') {
alert("Missing File to Upload.");
return false;
}
}
Your code
<form action="admin_profiles_main_update.php" method="post" name="submit_order" enctype="multipart/form-data" onsubmit="return validateForm(<?php echo $line; ?>);">
is outside the loop of linenumbers - so what should $line be, but null?
You either need to move the form into the loop of linenumbers, generating a form per row, or apply the logic on the submit button in question.
If you go with a form per row, you don't even need the linenumber thingy, cause then there would be exactly one value per variable in the submitted array. This would be the preferable way, cause you don't need to submit all values, when you want to modify one row.
And for the validation itself, you also wouldn't need it, cause you could refer to the form in question.
<?php
$line = 0;
while ($row_profile = mysql_fetch_array($result)){
$field_id = "_" . $line;
?>
<form action="admin_profiles_main_update.php" method="post" name="submit_order" enctype="multipart/form-data" onsubmit="return validateForm(<?php echo $line; ?>);">
<!-- do all the row stuff -->
</form>
<?$line++; }?>