PHP form with script do not do POST - javascript

i'm new with web programming and i have this problem, I have this little form:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Orden de Servicio</title>
<link rel="stylesheet" href="css/tabla.css">
<img src="img/logogps.png" alt="GPS" style="float:left; width:64px;height:64px; margin-left:1%;margin-top:1%;">
<script src="scripts/jquery-1.12.4.js"></script>
<script type="text/javascript">
function EnableAnom()
{
if($('#chkanom').is(':checked'))
{
document.getElementById("InputAudio").hidden = false;
document.getElementById("InputText").hidden = false;
document.getElementById("InputImage").hidden = false;
document.getElementById("lblaudio").hidden = false;
document.getElementById("txtdet").hidden = false;
document.getElementById("lblimg").hidden = false;
}
else
{
document.getElementById("InputAudio").hidden = true;
document.getElementById("InputText").hidden = true;
document.getElementById("InputImage").hidden = true;
document.getElementById("lblaudio").hidden = true;
document.getElementById("txtdet").hidden = true;
document.getElementById("lblimg").hidden = true;
}
}
</script>
</head>
<body>
<form action="checkprereg.php" method="POST" enctype="multipart/form-data">
<h2 class="text-center">Check PreInstalación</h2><br /><br />
<input type="hidden" name="id_orden" value=<?php echo $idorden; ?> />
<input type="hidden" name="chkenc" value="0">
<input type="checkbox" name="chkenc" value="1">
<label for="chkenc">Encendido</label><br>
<input type="hidden" name="chkapg" value="0">
<input type="checkbox" name="chkapg" value="1">
<label for="chkapg">Apagado</label><br>
<input type="hidden" name="chkcontig" value="0">
<input type="checkbox" name="chkcontig" value="1">
<label for="chkcontig">Continua / Ignición</label><br>
<input type="hidden" name="chkluces" value="0">
<input type="checkbox" name="chkluces" value="1">
<label for="chkluces">Luces</label><br>
<input type="hidden" name="chkotra" value="0">
<input type="checkbox" name="chkotra" value="1">
<label for="chkotra">Otra</label><br><br>
<label for="videvi">Video de evidencia (arranque):</label>
<input type="file" name="videvi" id="InputFile" accept="video/*"><br><br>
<label for="chkanom">Habilitar registro de anomalías</label>
<input type="checkbox" name="chkanom" id="chkanom" value="1" onclick="EnableAnom()" ><br><br>
<label for="audanom" hidden="true" id="lblaudio">Audio con detalles:</label>
<input type="file" name="audanom" id="InputAudio" accept="audio/*" hidden="true"><br><br>
<label for="textanom" hidden="true" id="txtdet">Detalles:</label>
<textarea name="textanom" id="InputText" rows="5" cols="50" hidden="true"></textarea><br><br>
<label for="imganom" hidden="true" id="lblimg">Imagen con detalles:</label>
<input type="file" name="imganom" id="InputImage" accept="image/*" hidden="true"><br><br>
<button class="button orange" type="submit" value="Submit">Enviar</button>
<button class="button orange" type="reset" value="Reset">Limpiar</button>
</form>
<p>
<a href="menu.php">
<img src="img/home.png" alt="Home" style="float:right; width:64px;height:64px; margin-left:1%;margin-top:1%;">
</a>
</p>
</body>
I did added a litlle script (EnableAnom()) that hides some inputs with a checkbox, but, with this script the form don't do POST, (I receive all vars empty) if I remove the script, the form works ok.
What is wrong in the script? (I did move up script up, down, without success)
Best regards.

<input type="hidden" name="id_orden" value=<?php echo $idorden; ?> />
change to
<input type="hidden" name="id_orden" value="<?php echo $idorden; ?>" />
and test first

Related

Add new created label and input-text to form using dom Javascript?

I have three fields that will be filled by the user.
one for the question, and the two others for the proposed answers. I want to give the user the possibility to add the third or as much as he wants propositions whenever he clicks at add proposition. I started coding the function but it's still missed
<head>
<script>
function myFunction(){
var x = document.createElement("LABEL");
var t = document.createTextNode("Titre");
x.appendChild(t);
}
</script>
</head>
<body>
<form id="myForm" method="POST" action="./exam_coordinates">
<label for="question"> Question </label> <br>
<input class="champ" type="textarea" name="question" id="question" value=""><br><br>
<label for="ans"> Answers </label> <br>
<input type="checkbox" name="ans1" id="ans1" values="" />
<input type="text" name="ans1" id="ans1" value=""><br>
<input type="checkbox" name="ans2" id="ans2" />
<input type="text" name="ans2" id="ans2" value=""><br>
<br>
<button onclick="myFunction()">Add proposition</button> <br><br><br>
<input type="submit" value="submit">
</form>
</body>
If I'm getting your question right, you need to add inputs to get more answers from user as he wants. If so, see the following -
var addButton = $('#add_button');
var wrapper = $('#more_answers');
$(addButton).click(function(e) {
e.preventDefault();
var lastID = $("#myForm input[type=text]:last").attr("id");
var nextId = parseInt(lastID.replace( /^\D+/g, '')) + 1;
$(wrapper).append(`<div><input type="checkbox" name="ans${nextId}" id="ans${nextId}" values="" /> <input type="text" name="ans${nextId}" id="ans${nextId}" value=""/>Delete<div>`);
});
$(wrapper).on("click", ".delete", function(e) {
e.preventDefault();
$(this).parent('div').remove();
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body>
<form id="myForm" method="POST" action="./exam_coordinates">
<label for="question"> Question </label> <br>
<input class="champ" type="textarea" name="question" id="question" value=""><br><br>
<label for="ans"> Answers </label> <br>
<input type="checkbox" name="ans1" id="ans1" values="" />
<input type="text" name="ans1" id="ans1" value=""><br>
<input type="checkbox" name="ans2" id="ans2" />
<input type="text" name="ans2" id="ans2" value=""><br>
<div id="more_answers"></div>
<br>
<button id="add_button">Add proposition</button> <br><br><br>
<input type="submit" value="submit">
</form>
</body>
In your function, you have to append your label as well in its parent. Like below -
function myFunction() {
var form = document.getElementById("myForm");
var input = document.createElement("input");
form.appendChild(input)
}
<form id="myForm" method="POST" action="./exam_coordinates">
<label for="question"> Question </label> <br>
<input class="champ" type="textarea" name="question" id="question" value=""><br><br>
<label for="ans"> Answers </label> <br>
<input type="checkbox" name="ans1" id="ans1" values="" />
<input type="text" name="ans1" id="ans1" value=""><br>
<input type="checkbox" name="ans2" id="ans2" />
<input type="text" name="ans2" id="ans2" value=""><br>
<br>
<button type="button" onclick="myFunction()">Add proposition</button> <br><br>
<input type="submit" value="submit">
</form>
If you want to put your elements at any specific place, you should create a wrapper in your form element just like below -
function myFunction() {
let wrapper = document.getElementById("dynamic-fields");
var input = document.createElement("input");
wrapper.appendChild(input)
}
<form>
<!-- ...input fields... -->
<div id="dynamic-fields"></div> <br>
<!-- ...buttons.... -->
<button type="button" onclick="myFunction()">Add proposition</button>
</form>
This way it will put those dynamically generated elements on specific place in your form page.
Try this - https://jsitor.com/IO08f-WBx

Error gateway response

I have a question about the process of the payment using a gateway emerchant. I have to provide all the variables to the gateway and get the answer if the charge was made. I can make the charge if all the data is correct, but i don't know how to receive the answer from the gateway, the manual give me a clue, the answer will provide in the variable "urlBack". Do you know how to get data from this gateway?
First I process all date in javascript then I send the information using the following code, but the answer I will receive in another page (https://acmax.mx/popup_2). All works very well but I have problems with the answer from the gateway.
Thank so much
<form name="myPayTC" id="myPayTC" method="post" action="https://www.procom.prosa.com.mx/eMerchant/7727222_acmaxdemexico.jsp" onload='javascript:MyFrmOnLoad();'>
<input type="hidden" id="total" name="total" value='total'>
<input type="hidden" id="currency" name="currency" value="484">
<input type="hidden" id="address" name="address" value="ACMAX">
<input type="hidden" id="order_id" name="order_id" value='order_id'>
<input type="hidden" id="merchant" name="merchant" value="7727222">
<input type="hidden" id="store" name="store" value="1234">
<input type="hidden" id="term" name="term" value="001">
<input type="hidden" id="digest" name="digest" value='valDigest'>
<input type="hidden" id="return_target" name="return_target" value="N/A">
<!--<input type="hidden" id="urlBack" name="urlBack" value="https://acmax.mx/index.php?controller=ComercioResp">-->
<!--<input type="hidden" id="urlBack" name="urlBack" value="https://acmax.mx/es/checkout/confirm">-->
<input type="hidden" id="urlBack" name="urlBack" value="https://acmax.mx/popup_2">
<!--<input type="hidden" id="urlBack" name="urlBack" value="http://acmax.mx/es/checkout/paymentmethod">-->
<p><img src="https://acmax.mx/themes/theme674/img//bankwire.jpg" alt="Pago por tarjeta de crédito/débito" width="86" height="54" /> <input type="submit" name="pButton" value="Pago con Tarjeta de Crédito/Débito" class="exclusive" style="font-size:14px; height:28px;"></p>
</form>
The code that has the server is the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML version="-//W3C//DTD HTML 4.01 Transitional//EN">
<HEAD>
<TITLE>Verificacion de Compra</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</HEAD>
<BODY>
<form id="formars" name="formars" action="https://acmax.mx/popup_2" method="post">
<input type="Hidden" name="EM_Response" value="denied">
<input type="Hidden" name="EM_Total" value="102">
<input type="Hidden" name="EM_OrderID" value="625">
<input type="Hidden" name="EM_Merchant" value="7727222">
<input type="Hidden" name="EM_Store" value="1234">
<input type="Hidden" name="EM_Term" value="001">
<input type="Hidden" name="EM_RefNum" value="initialrefnum">
<input type="Hidden" name="EM_Auth" value="000000">
<input type="Hidden" name="EM_Digest" value="initialdigest">
<input type="Hidden" name="cc_number" value="0565">
<input type="Hidden" name="total" value="102">
<input type="Hidden" name="order_id" value="625">
<input type="Hidden" name="merchant" value="7727222">
<input type="Hidden" name="tx_id" value="322307f91ef2b5318e5d720f49fb30dace2ca474">
<input name="pButton" value="Pago con Tarjeta de Crédito/Débito" type="Hidden" />
<input name="address" value="ACMAX" type="Hidden" />
</form>
<script type="text/javascript">
var formars = document.getElementById('formars');
formars.submit();
</script>
</BODY>
</HTML>
I can't change this code, so I need to get the data from the form "formars"
Well, for example, if you have set the urlBack parameter to some php page, let's call it returnCall.php.
Now, if the payment gateway is sending back the following 'post' data:
name1=cat&name2=dog&name3=echidna
Then in your php page, you can read that data as follows:
<?php
$value1 = $_POST["name1"];
$value2 = $_POST["name2"];
$value3 = $_POST["name3"];
?>
<p>
<ul>
<li>Value1 = <?=$value1?></li>
<li>Value2 = <?=$value2?></li>
<li>Value3 = <?=$value3?></li>
</ul>
</p>
Then the output on the page would translate to:
<p>
<ul>
<li>Value1 = cat</li>
<li>Value2 = dog</li>
<li>Value3 = echidna</li>
</ul>
</p>
You could similarly have an aspx page that could do the same thing.
string Value1;
string Value2;
string Value3;
protected void Page_Load(object sender, EventArgs e)
{
Value1 = Request.Form["name1"];
Value2 = Request.Form["name2"];
Value3 = Request.Form["name3"];
}

Uploading to S3 via POST?

I've been trying to upload to S3 via post, and found a good example:
<html>
<head>
<title>S3 POST Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="https://s3-bucket.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
<input type="hidden" name="key" value="uploads/${filename}">
<input type="hidden" name="AWSAccessKeyId" value="YOUR_AWS_ACCESS_KEY">
<input type="hidden" name="acl" value="private">
<input type="hidden" name="success_action_redirect" value="http://localhost/">
<input type="hidden" name="policy" value="YOUR_POLICY_DOCUMENT_BASE64_ENCODED">
<input type="hidden" name="signature" value="YOUR_CALCULATED_SIGNATURE">
<input type="hidden" name="Content-Type" value="image/jpeg">
<!-- Include any additional input fields here -->
File to upload to S3:
<input name="file" type="file">
<br>
<input type="submit" value="Upload File to S3">
</form>
</body>
</html>
I know what the "Access Key" value means, but what about the policy document and calculated signature? How do I find or create those?
<?php
$form['policy'] = '{ "expiration": "2090-12-30T12:00:00.000Z",
"conditions": [
{"bucket": "idclkimages"},
["starts-with", "$key", "user/user1/"],
{"acl": "public-read"},
{"success_action_redirect": "http://idclkimages.s3.amazonaws.com/successful_upload.html"},
["starts-with", "$Content-Type", "image/"],
{"x-amz-meta-uuid": "14365123651274"},
{"x-amz-server-side-encryption": "AES256"},
["starts-with", "$x-amz-meta-tag", ""],
{"x-amz-credential": "PUT-YOUR-ACCESS-KEY-HERE/20901229/ap-south-1/s3/aws4_request"},
{"x-amz-algorithm": "AWS4-HMAC-SHA256"},
{"x-amz-date": "20901229T000000Z" }
]
}';
$form['policy_encoded'] = base64_encode($form['policy']);
$form['signature'] = base64_encode(hash_hmac( 'AWS4-HMAC-SHA256', base64_encode(utf8_encode($form['policy'])), 'PUT-YOUR-SECRET-KEY-HERE',true));
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="http://idclkimages.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
Key to upload:
<input type="input" name="key" value="user/user1/${filename}" /><br />
<input type="hidden" name="acl" value="public-read" />
<input type="hidden" name="success_action_redirect" value="http://idclkimages.s3.amazonaws.com/index.php" />
Content-Type:
<input type="input" name="Content-Type" value="image/jpeg" /><br />
<input type="hidden" name="x-amz-meta-uuid" value="14365123651274" />
<input type="hidden" name="x-amz-server-side-encryption" value="AES256" />
<input type="text" name="X-Amz-Credential" value="PUT-YOUR-ACCESS-KEY-HERE/20901229/ap-south-1/s3/aws4_request" />
<input type="text" name="X-Amz-Algorithm" value="AWS4-HMAC-SHA256" />
<input type="text" name="X-Amz-Date" value="20901229T000000Z" />
Tags for File:
<input type="input" name="x-amz-meta-tag" value="" /><br />
<input type="hidden" name="Policy" value='<?php echo $form['policy_encoded'] ?>' />
<input type="hidden" name="X-Amz-Signature" value="<?php echo $form['signature'] ?>" />
File:
<input type="file" name="file" /> <br />
<!-- The elements after this will be ignored -->
<input type="submit" name="submit" value="Upload to Amazon S3" />
</form>
</html>

how to put form text exactly in front of radio button

I want to put 'email me' & 'call me' text exactly in front radio button. In code it comes under radio button. Can anybody suggest me how to do this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
$('#emailbtn').on('click',function(){
if($('#callbtn').prop('checked'))
{
$('#callbtn').prop('checked','');
}
});
$('#callbtn').on('click',function(){
if($('#emailbtn').prop('checked'))
{
$('#emailbtn').prop('checked','');
}
});
</script>
</head>
html code is
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<form name="form1" method="post" style="padding-left:8%;">
<input type="radio" value="email" name="select" id="emailbtn" onclick="showemail()" />
Email me :<span id="emailhide" style="display:none"><input type="text" size="50" name="email" id="email_id" placeholder="*************" /><input type="submit" name="email" value="email" id="emailbtn" style="font-size:16px;" onclick="return validation1()" /></span>
<span id="emailid"></span>
</form>
<form name="form2" method="post" style="padding-left:8%;">
<input type="radio" value="call" name="select" id="callbtn" onclick="showphn()" />
Call Me :<span id="phonehide" style="display:none"><input type="text" size="50" name="phn" id="call" placeholder="*************" /><input type="submit" name="submit" value="call" id="callbtn" onclick="return validation2()" /></span>
<span id="phoneno"></span>
</form>
<input type="radio" value="chat" name="select" id="chatbtn" onclick="showchat()" />
Chat with me<span id="chathide"><input style="display:none" type="submit" name="chat" id="chat" value="Go"/></span>
Add the radio buttons in the forms: FIDDLE
<form name="form1" method="post" style="padding-left:8%;">
<input type="radio" value="email" name="select" id="emailbtn" onclick="showemail()" />Email me :<span id="emailhide" style="display:none">
<input type="text" size="50" name="email" id="email_id" placeholder="*************" />
<input type="submit" name="email" value="email" id="emailbtn" style="font-size:16px;" onclick="return validation1()" />
<span id="emailid"></span>
</form>
<form name="form2" method="post" style="padding-left:8%;">
<input type="radio" value="call" name="select" id="callbtn" onclick="showphn()" />Call Me :<span id="phonehide" style="display:none">
<input type="text" size="50" name="phn" id="call" placeholder="*************" />
<input type="submit" name="submit" value="call" id="callbtn" onclick="return validation2()" />
<span id="phoneno"></span>
</form>
$(document).on('ready',function(){$('#emailbtn').on('click',function(){
if($('#callbtn').prop('checked'))
{
$('#callbtn').prop('checked','');
}
});
$('#callbtn').on('click',function(){
if($('#emailbtn').prop('checked'))
{
$('#emailbtn').prop('checked','');
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<form name="form1" method="post" style="padding-left:8%;">
<input type="radio" value="email" name="select" id="emailbtn" onclick="showemail()" />
Email me :<span id="emailhide" style="display:none"><input type="text" size="50" name="email" id="email_id" placeholder="*************" /><input type="submit" name="email" value="email" id="emailbtn" style="font-size:16px;" onclick="return validation1()" /></span>
<span id="emailid"></span></form>
<form name="form2" method="post" style="padding-left:8%;">
<input type="radio" value="call" name="select" id="callbtn" onclick="showphn()" />
Call Me :<span id="phonehide" style="display:none"><input type="text" size="50" name="phn" id="call" placeholder="*************" /><input type="submit" name="submit" value="call" id="callbtn" onclick="return validation2()" /></span>
<span id="phoneno"></span>
</form>

Load Div after Submit Required Fields on PHP Form

I have a hidden div I am loading on click of submit button. I also have .notShouldBeBlank on the script for the form. What is the right method so that the php sends results and the hidden div will not load until all required fields are complete? It's currently loading the hidden div and sending results as soon as I click submit. What am I doing wrong?
<?php
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$name = stripslashes($name);
$address = stripslashes($address);
$city = stripslashes($city);
$state = stripslashes($state);
$phone = stripslashes($phone);
$email = stripslashes($email);
$to = 'myemail#thisismywebsite.com ' . ', ';
$to .= $Email;
$from = "$Email ";
$subject = 'Look and Learn: Applicant';
$message = <<<EOF
<html>
<body bgcolor="#FFFFFF">
<b>Look and Learn: Applicant</b><br /><br />
<b>Name:</b> $name<br />
<b>Address:</b> $address / $city, $state<br />
<b>Phone:</b> $phone<br />
<b>Email:</b> $email<br />
</body>
</html>
EOF;
//end of message
// Additional headers
$headers .= 'From: Razor Chic of Atlanta <info#thebrlab.com>' . "\r\n";
$headers .= "Content-type: text/html\r\n";
$to = "$to";
mail($to, $subject, $message, $headers);
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Sign Up</title>
<link rel="stylesheet" href="css/sign-up.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#submit').click(function() {
$('#thankyou').show();
$("#hidden1").html($("#thankyou").html());
});
});
</script>
<script>
$('#myContact').submit(function () {
$.each($('#myContact .notShouldBeBlank'), function()
{
if($(this).val() == ''){
$(this).after('<span class="error">This field is required.</span>');
}
});
// Other groups validated here
}
</script>
</head>
<body style="overflow: hidden; overflow-x: hidden; overflow-y: hidden;">
<div id="wrap">
<div id="hidden1"></div>
<div style="font-size: 18px; font-weight: bold; font-family: Verdana, Geneva, sans-serif;">
Sign-Up: Look And Learn Class
</div>
<br>
<form id="form" action="" name="myContact" onSubmit="return validateForm()" method="post" enctype="multipart/form-data">
<div>
<label>
<span>Name: *</span><br>
<input name="name" type="text" size="64" placeholder="Name">
</label>
</div>
<div>
<table width="100%" >
<tr>
<td width="230">
<label>
<span>Address: *</span><br>
<input placeholder="Address" size="100" type="text" name="address" maxlength="100">
</label>
</td>
<td width="160">
<label>
<span>City *</span><br>
<input placeholder="City" name="city" type="text" id="city" maxlength="100" />
</label>
</td>
<td width="189">
<label>
<span>State *</span><br>
<input placeholder="State" name="city" type="text" id="city" maxlength="3" />
</label>
</td>
</tr>
</table>
</div>
<div>
<label>
<span>Phone: *</span><br>
<input placeholder="Phone" size="64" type="text" name="phone">
</label>
</div>
<div>
<label>
<span>Email: *</span><br>
<input placeholder="Email address" size="64" type="email" name="email">
</label>
</div>
<div>
<button name="submit" type="submit" id="submit">S I G N U P</button>
</div>
</form>
<p>Note: * Fields are required</p>
</div>
<!---- THANK YOU---->
<?php
if($sent){
echo '<div id="thankyou" style="display:block;">';
}
else{
echo '<div id="thankyou" style="display:none;">';
}
?>
<!---- PAY BEGINS ---->
<div id="paynow1-wrapper">
<div id="paynow1">
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="Razorchicofatlanta#gmail.com">
<input type="hidden" name="item_name" value="Look and Learn: Deposit">
<input type="hidden" name="amount" value="100.00">
<input type="hidden" name="return" value="http://thebrlab.com/razor-chic-of-atlanta/thank-you.html">
<input type="hidden" name="undefined_quantity" value="1">
<input style="background: none" onMouseOver="this.src='images/pay-now-up.png'" onMouseOut="this.src='images/pay-now-down.png'" type="image" src="images/pay-now-down.png" height="41" width="141" border="0" alt="Pay Now" class="button">
</form>
</div>
</div>
<!---- PAY ENDS ---->
<!---- PAY BEGINS ---->
<div id="paynow2-wrapper">
<div id="paynow2">
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="Razorchicofatlanta#gmail.com">
<input type="hidden" name="item_name" value="Look and Learn: Balance">
<input type="hidden" name="amount" value="99.00">
<input type="hidden" name="return" value="http://thebrlab.com/razor-chic-of-atlanta/thank-you.html">
<input type="hidden" name="undefined_quantity" value="1">
<input style="background: none" onMouseOver="this.src='images/pay-now-up.png'" onMouseOut="this.src='images/pay-now-down.png'" type="image" src="images/pay-now-down.png" height="41" width="141" border="0" alt="Pay Now" class="button">
</form>
</div>
</div>
<!---- PAY ENDS ---->
<!---- PAY BEGINS ---->
<div id="paynow3-wrapper">
<div id="paynow3">
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="Razorchicofatlanta#gmail.com">
<input type="hidden" name="item_name" value="Look and Learn: Full Payment">
<input type="hidden" name="amount" value="199.00">
<input type="hidden" name="return" value="http://thebrlab.com/razor-chic-of-atlanta/thank-you.html">
<input type="hidden" name="undefined_quantity" value="1">
<input style="background: none" onMouseOver="this.src='images/pay-now-up.png'" onMouseOut="this.src='images/pay-now-down.png'" type="image" src="images/pay-now-down.png" height="41" width="141" border="0" alt="Pay Now" class="button">
</form>
</div>
</div>
<!---- PAY ENDS ---->
<img src="images/thank-you/look-and-learn1.png" />
</div>
<!---- THANK YOU---->
</body>
</html>
Your form ID is "form", not "myContact". Change form id to myContact.
Then you have 2 "onsubmit" events, one in jQuery and the other inline (onSubmit). Try to merge them into one to avoid unexpected behaviors.
Also, make sure you return false on your submit event function if the validation fails, so the submit is halted.
Update 1
JavaScript:
$('#myContact').submit(function () {
$.each($('#myContact .notShouldBeBlank'), function()
{
if($(this).val() == ''){
$(this).after('<span class="error">This field is required.</span>');
return false;
}
});
/* Uncomment the line below if you really have a validateForm() function */
// return validateForm()
}
HTML:
<form id="myContact" action="" name="myContact" method="post" enctype="multipart/form-data">

Categories

Resources