I'm trying to do a data extraction from a .NET web server but I cannot send the data correctly.
If I post the data with a normal html form I can show the correct page with the information I need.
The html form contains valid fields as __VIEWSTATE, __EVENTVALIDATION and other fields to query the server.
This form works fine but I cannot capture any data.
If I try to send the same data (with the POST method) using javascript with ActiveXObject("Msxml2.XMLHTTP.3.0"); or using Server.CreateObject("MSXML2.ServerXMLHTTP") in classic ASP, I receive in return from the server the message:
''The state information is invalid for this page and might be corrupted.,, or the correct page w/o the result of the query (page empty).
I think the problem is in the header, so I've tried to send in many formats but w/o success.
Any help ?
the following is the code that correctly send data
<form name="aspnetForm" method="post" action="http://geon....neNew.aspx" id="aspnetForm">
<input type="text" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="text" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />`enter code here`
<input type="text" name="__VIEWSTATE" id="__VIEWSTATE" value="/--------- here the key --"/>
<input type="text" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/--------- here the key --" />
<br>
DUG:
<input name="ctl00$ContentPlaceHolder1$txtDUG" type="text" id="ctl00_ContentPlaceHolder1_txtDUG" <td id="ctl00_ContentPlaceHolder1_TableCell3">
<br>
Denomin.:
<input name="ctl00$ContentPlaceHolder1$txtDenominazione" type="text" value="indipendenza" id="ctl00_ContentPlaceHolder1_txtDenominazione" >
<br>
Civico:
<input name="ctl00$ContentPlaceHolder1$txtCivico" type="text" value="34" id="ctl00_ContentPlaceHolder1_txtCivico" />
<br>
Espon:
<input name="ctl00$ContentPlaceHolder1$txtEsponente" type="text" id="ctl00_ContentPlaceHolder1_txtEsponente" >
<br>
CAP:
<input name="ctl00$ContentPlaceHolder1$txtCAP" type="text" maxlength="5" id="ctl00_ContentPlaceHolder1_txtCAP" >
<br>Prov.:
<input name="ctl00$ContentPlaceHolder1$txtSiglaProv" type="text" id="ctl00_ContentPlaceHolder1_txtSiglaProv" />
<br>
Comune:
<input name="ctl00$ContentPlaceHolder1$txtComune" type="text" value="gazzo" id="ctl00_ContentPlaceHolder1_txtComune" >
<b>Informazioni addizionali</b></p>
<input id="ctl00_ContentPlaceHolder1_chkUffRecapito" type="checkbox" name="ctl00$ContentPlaceHolder1$chkUffRecapito" tabindex="9" />
<label for="ctl00_ContentPlaceHolder1_chkUffRecapito">Centro/Presidio decentrato di distribuzione</label>
<br>
<input id="ctl00_ContentPlaceHolder1_chkCodPre" type="checkbox" name="ctl00$ContentPlaceHolder1$chkCodPortalettere" tabindex="10" />
<label for="ctl00_ContentPlaceHolder1_chkCodPre">Numero Potere</label>
<br>
<input id="ctl00_ContentPlaceHolder1_chkAmbigui" type="checkbox" name="ctl00$ContentPlaceHolder1$chkAmbigui" tabindex="11" />
<label for="ctl00_ContentPlaceHolder1_chkAmbigui">Scarta in caso di indirizzi ambigui</label>
<br>
<input type="submit" name="ctl00$ContentPlaceHolder1$cmdNormalizza" value="Normalizza" id="ctl00_ContentPlaceHolder1_cmdNormalizza" />
<br>
</form>
</body>
</html>
---- and this is the code that capture the data in the form but send data incorrectly:
<script>
var req1 = new XMLHttpRequest();
req1.open('GET', document.location, false);
req1.send(null);
var headers = req1.getAllResponseHeaders().toLowerCase();
//alert(headers);
document.write(headers+'<p>');
var formElements=document.getElementById("aspnetForm").elements;
var postData={};
var qs;
qs="";
for (var i=0; i<formElements.length; i++) {
if (formElements[i].type!="submit")
{
qs=qs + formElements[i].name + "=" + formElements[i].value + "&" ;
// alert(formElements[i].name);
}
}
//qs = qs.substring(0, qs.length - 1);
qs=qs +"ctl00$ContentPlaceHolder1$cmdNormalizza=Normalizza"
document.write(qs);
var req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
req.open('POST', 'http://geono....LineNew.aspx', false);
//req.open('POST', 'http://vepdcm1sa01/exps/x2/read.asp', false);
//req.setRequestHeader('Content-Type', 'text/plain;');
req.setRequestHeader('cache-control','private');
//req.setRequestHeader('content-length','162107');
req.setRequestHeader('content-type','text/plain');
req.setRequestHeader('server','microsoft-iis/7.5');
//req.setRequestHeader('date',' tue, 19 feb 2019 10:17:55 gmt');
req.send(qs);
if(req.status == 200)
document.write(req.responseText);
</script>
Related
I have a jsp page in my project. In this jsp page, I have inputs that are filling by javascript function. When the servlet post action happens, this input's values are disappears. I want to fill these input again when the servlet forwarded the jsp page. So, is it possible to trigger a javascript function from servlet?
My JSP page codes
<div style="margin-left:7%; margin-right:10%; border-style:groove;">
<div style="margin-right:65&; margin-left:5px;">
<label for="salesOrder">Sales Order</label> <input id="sOrder" style="margin-left:58px;" onkeyup="this.value = this.value.toUpperCase();" onselect="salesOrder();fill_table();" value="${salesorder}"> <label style="margin-left:75px;">Count:</label> <input type="text" id="count" size="3" style="margin-top:3px;"><br>
<label>Ind. Date:</label> <input type="text" id="induction" style="margin-left:59px;" size="15"><br>
<label>Customer/Operator:</label> <textarea id="customer" rows="1" cols="10" wrap="soft"></textarea> <textarea id="operator" rows="1" cols="10" wrap="soft"></textarea><br>
<label>Removal Reason:</label> <textarea rows="2" cols="30" wrap="soft" id="rem_reason" style="margin-left:10px; height:50px; text-size:10px;"></textarea>
</div>
<div style="margin-left:45%; margin-top:-130px;">
<input type="checkbox" name="v2500" value="V2500-A5" onclick="check_v25()"> <label for="v2500">V2500-A5</label><br>
<input type="checkbox" name="7b" value="CFM56-7B" onclick="check_7b()"> <label for="7b">CFM56-7B</label><br>
<input type="checkbox" name="5c" value="CFM56-5C" onclick="check_5c()"> <label for="5c">CFM56-5C</label><br>
<input type="checkbox" name="3" value="CFM56-3" onclick="check_3()"> <label for="3">CFM56-3</label>
</div>
<div style="margin-left:65%; margin-top:-130px;">
<label>TSN:</label> <input type="text" id="tsn" style="margin-left:1px;"><br>
<label>CSN:</label> <input type="text" id="csn" style="margin-left:-0.5px;"><br>
<label>TSLSV:</label> <input type="text" id="tslsv" style="margin-left:-1px;"><br>
<label>CSLSV:</label> <input type="text" id="cslsv" style="margin-left:-3px;">
</div>
</div>
My JavaScript function
<script>
function salesOrder(event,ui){
$("#sOrder").val(ui.item.label);
var salesOrder=$("#sOrder").val();
var URL_PREFIX="http://ptrisd01:8983/solr/SalesOrderCore/select?q=STRSO:";
var URL=URL_PREFIX+salesOrder;
$.ajax({
url : URL,
dataType : 'json',
type:'get',
json : 'json.wrf',
success:function(data){
console.log("success");
var docs = JSON.stringify(data.response.docs);
var jsonData = JSON.parse(docs);
document.getElementById("induction").value=jsonData[0].STRINDDATE;
document.getElementById("customer").value=jsonData[0].STRCUSTOMER;
document.getElementById("operator").value=jsonData[0].STROPERATOR;
document.getElementById("rem_reason").value=jsonData[0].STRREMREASON;
document.getElementById("tsn").value=jsonData[0].STRTSN;
document.getElementById("csn").value=jsonData[0].STRCSN;
document.getElementById("tslsv").value=jsonData[0].STRTSLSV;
document.getElementById("cslsv").value=jsonData[0].STRCSLSV;
}
});
};
</script>
A part of my servlet codes
request.setAttribute("salesorder", salesOrder_hidden);
PrintWriter out = response.getWriter();
out.println("<script type=\"text/javascript\">");
//out.println("alert('Saving completed...');");
//out.println("location='upload.jsp';");
out.println("salesOrder();");
out.println("</script>");
request.getRequestDispatcher("upload.jsp").forward(request, response);
Also, I'm using JQuery Autocomplete for sOrder input.
What Swati said. Looks like you don't know about sessions yet. If you do it with Java, create Session at the servlet.
HttpSession session = request.getSession();
session.setAttribute("attributeName", value);
response.sendRedirect("your.jsp");
I have a problem described as title.
<form id="mloginform">
Manager ID: <input type="text" name="mid" id="mid" > </label>
<br/>
Password: <input type="text" name="mpwd" id="mpwd"> </label>
<br/>
<input type="submit" name="mlogin" value="login" id="mlogin"/>
</form>
Above is the simple form i have.
var xhr = createRequest(); // this is in another js.
function checklogin(mid, mpwd) {
var mid = document.getElementById("mid").value;
var mpwd = document.getElementById("mpwd").value;
var moutput = document.getElementById("moutput");
alert(encodeURIComponent(mid));
alert(encodeURIComponent(mpwd));
moutput.innerHTML = "";
xhr.open("GET", "mlogin.php?mid=" + encodeURIComponent(mid) + "&mpwd=" + encodeURIComponent(mpwd) + "&value=" + Number(new Date), true);
xhr.send(null);
}
Above is the xhr code. two alert did show the input value. but xhr.open cant send data to php file (only page refreshed, nothing else); i am pretty sure the problem is located in xhr.open, because php works fine if i use following form.
<form action="mlogin.php" method="get" id="mloginform">
Manager ID: <input type="text" name="mid" id="mid" > </label>
<br/>
Password: <input type="text" name="mpwd" id="mpwd"> </label>
<br/>
<input type="submit" name="mlogin" value="login" id="mlogin"/>
</form>
How do I check multiple variable inputs at once to ensure that the regex is working? Everytime I enter anything, the form submits and doesn't alert anything.
I have tried test()method of regex validation too, and still no luck.
I am trying to validate user input with the following regex that makes to where anything that is not a number or blank space is considered a wrong input.
var format=/^(\s*|\d+)$/;
It only accepts numbers and blank spaces in the text box.
The following javascript is what I have:
var pitch = document.getElementById("pitch");
var chisel = document.getElementById("chis");
var saw = document.getElementById("saw");
//var arguments = [chisel, saw, pitch];
var format = /^(\s*|\d+)$/;
function regexTest() {
if (!chisel.match(format) && !saw.match(format) && !pitch.match(format)) {
alert("Repressed Action");
return false;
} else {
alert('Thank you');
}
}
<div class="lab">
<form method="post" action="http://weblab.kennesaw.edu/formtest.php">
Chisels: <input type="text" name="chisels" id="chis" size="5" /> Saw: <input type="text" name="saw" id="saw" size="5" /> Pitchfork: <input type="text" name="pitchfork" id="pitch" size="5" />
<br /> Customer Name: <input type="text" name="customer name" size="25" />
<br /> Shipping Address: <input type="text" name="shipping address" size="25" />
<br /> State:
<input type="radio" id="master" name="card" value="master" /><label for="master">MasterCard</label>
<input type="radio" id="american" name="card" value="american" /><label for="american">American Express</label>
<input type="radio" id="visa" name="card" value="visa" /><label for="visa">Visa</label>
<br />
<input type="reset" value="Reset" />
<div class="lab">
<button onclick="regexTest()">Submit</button>
<button onclick="return false">Cancel</button>
</div>
There are a number of issues with your code, below I've refactored it to be a bit easier to read and so it works.
The validation listener should be on the form's submit handler, not the submit button since forms can be submitted without clicking the button. Also, if you pass a reference to the form to the listener, it's much easier to access the form controls by name.
You should get the values of the form controls when the submit occurs, not before. Your code gets the values immediately, before the user has done anything (and possibly before the form even exists), so put that code inside the listener function.
Lastly, the regular expression needs to match anything that isn't a space or digit, so:
/[^\s\d]/
seems appropriate. However, this will still allow the form to submit if the fields are empty (they don't contain non-digits or non-spaces). You'll need to add a test for that.
function regexTest(form) {
// Get values when the function is called, not before
var pitch = form.pitchfork.value;
var chisel = form.chisels.value;
var saw = form.saw.value;
// Test for anything that's not a space or digit
// var format = /^(\s*|\d+)$/;
var format = /[^\s\d]/;
if (format.test(chisel) || format.test(pitch) || format.test(saw)) {
// There must be at least one non-space or non-digit in a field
alert("Repressed Action");
return false;
} else {
alert('Thank you');
// return false anyway for testing
return false;
}
}
<div class="lab">
<form onsubmit="return regexTest(this)">
Chisels: <input type="text" name="chisels" id="chis" size="5"><br>
Saw: <input type="text" name="saw" id="saw" size="5"><br>
Pitchfork: <input type="text" name="pitchfork" id="pitch" size="5"><br>
Customer Name: <input type="text" name="customer name" size="25"><br>
Shipping Address: <input type="text" name="shipping address" size="25">
<br> State:
<select name="states">
<option>Florida</option>
<option>Georgia</option>
<option>Alabama</option>
</select>
<br>
<input type="radio" id="master" name="card" value="master"><label for="master">MasterCard</label>
<input type="radio" id="american" name="card" value="american"><label for="american">American Express</label>
<input type="radio" id="visa" name="card" value="visa"><label for="visa">Visa</label>
<br>
<input type="reset" value="Reset">
<div class="lab">
<button>Submit</button>
<button onclick="return false">Cancel</button>
</div>
Hopefully this gets you to the next step.
I am trying to scrape a webpage with cheerio, but my request is being blocked with some sort of bot-detecting software. The response looks like this:
<body>
<div class="content">
...
<div class="main">
<h1>Suspicious activity detected</h1>
<div class="box">
<p>Due to suspicious activity from your computer, we have blocked your access to http://www.something.com. After completing the form, your information will be evaulauted and you may be unblocked. </p>
<p><span>Note</span>: This website may require JavaScript. If you have JavaScript disabled, please enable it before attempting to return to http://www.something.com.</p>
<div class="block">
<form id="distilUnblockForm" method="post" action="http://verify.distil.it/distil_blocked.php">
<div id="dUF_first_name">
<label for="dUF_input_first_name">First Name:</label>
<input type="text" id="dUF_input_first_name" name="first_name" value="" />
</div>
<div id="dUF_last_name">
<label for="dUF_input_last_name">Last Name:</label>
<input type="text" id="dUF_input_last_name" name="last_name" value="" />
</div>
<div id="dUF_email">
<label for="dUF_input_email">E-mail:</label>
<input type="text" id="dUF_input_email" name="email" value="" />
</div>
<div id="dUF_city" style="display: none">
<label for="dUF_input_city">City (Leave Blank):</label>
<input type="text" id="dUF_input_city" name="city" value="" />
</div>
<div id="dUF_unblock">
<input id="dUF_input_unblock" name="unblock" type="submit" value="Request Unblock" />
</div>
<div id="dUF_unblock_text">
You reached this page when attempting to access https://someWebsite from myIPAddress on someDateInISOFormat.
</div>
<div id="dUF_form_fields" style="display: none">
<input type="hidden" name="B" value="someNumbersAndLetters" />
<input type="hidden" name="P" value="someMoreNumbersAndLetters" />
<input type="hidden" name="I" value="" />
<input type="hidden" name="U" value="" />
<input type="hidden" name="V" value="###" />
<input type="hidden" name="O" value="" />
<input type="hidden" name="D" value="###" />
<input type="hidden" name="A" value="###" />
<input type="hidden" name="LOADED" value="someDate" />
<input type="hidden" name="Q" value='someUrl' />
<input type="hidden" id="distil_block_identity_info" name="XX" value="" />
</div>
</form>
...
</body>
I am thinking I can get around this by added a callback with a post function, but it doesn't seem to be working. My code is below:
var url = someUrl;
request(url, function (error, response, html) {
console.log("html", html); //where i am getting the above html
request.post({
uri: 'hhttp://verify.distil.it/distil_blocked.php',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
body: require('querystring').stringify(credentials)
}, function(err, res, body){
if(err) {
callback.call(null, new Error('Login failed'));
return;
} else {
var $ = cheerio.load(html);
var parsedResults = [];
$('#someSelector').each(function(i, element){
var node = $(this).children();
// Get all the children
var something = $(node).eq(0).text();
var anotherThing = $(node).eq(1).text();
var oneMoreThing = $(node).eq(2).text();
// Make it into an object
var metadata = {
something: something,
anotherThing: anotherThing,
oneMoreThing: oneMoreThing
};
// Push meta-data into parsedResults array
parsedResults.push(metadata);
});
// Log our finished parse results in the terminal
console.log(parsedResults);
}
});
});
This is failing on the post request, I am not sure if it is because I am doing the callback wrong or if the post request is not a valid way to work around the bot. Any help is greatly appreciated, thanks.
I realized I was having issues because cheerio does not load javacsript. The site I was trying to scrape loads data with javacsript, so I need to use a different tool. Probably will use (PhantomJS)[http://phantomjs.org/].
You should try setting your headers as browser-like as you can. For instance, you are not setting your user-agent, cache-control, accept, etc. That makes it dead simple for the site to detect you are not a browser.
Check the header on a normal request (on Chrome use More Tools-> Developer Tools, network and select the HTML file. More info on this thread) and send yours as similar to those as you can.
I have an insert form where I can submit data into my database.
Here's my code:
<form action="insert_backend.php" method="POST" enctype="multipart/form-data">
<!-- Method can be set as POST for hiding values in URL-->
<h2>Form</h2>
<label for="uploadedimage">Small image to upload: </label>
<input type="file" name="uploadedimage" id="uploadedimage"/><br />
<label>Date:</label>
<input class="input" name="date" type="text" value=""><br />
<label>Retrace:</label>
<input class="input" name="retrace" type="text" value=""><br />
<label>Start of Swing Trade:</label>
<input class="input" name="start_of_swing_trade" type="text" value=""><br />
<label>End of Swing Trade:</label>
<input class="input" name="end_of_swing_trade" type="text" value=""><br />
<label>Bull flag:</label>
<input class="input" name="bull_flag" type="text" value=""><br />
<label>Bear flag:</label>
<input class="input" name="bear_flag" type="text" value=""><br />
<label>EMA Crossover:</label>
<input class="input" name="ema_crossover" type="text" value=""><br />
<label>Trading Instrument:</label>
<input class="input" name="trading_instrument" type="text" value=""><br />
<input class="submit" name="submit" type="submit" value="Insert">
</form>
Here's a snippet of the "Success" message on the php that is used to process the data submitted to the database:
$stmt->bind_param('sssssssss',$target_path, $date, $retrace, $start_of_swing_trade, $end_of_swing_trade, $bull_flag, $bear_flag, $ema_crossover, $trading_instrument);
if(!$stmt){ exit("bind failed");}
//will return 0 if fail
if($stmt->execute() != 0){
echo "New record created successfully";
}else{ echo "Failed to insert new record";}
Whenever I Insert data, I get the "New record created successfully" message on the insert_backend.php page, which is the php file used to process and submit the data, but not on the actual form page used to insert data. Usually when you use a form to send a message to someone or to send data into a database, the form resets itself and you get a "success" message that shows at the bottom of the form without getting redirected to another page. But the code I have redirects me to the page that is used to process the data. how do I get it to show the "success" message on the same page as the form itself?
My FULL insert form code (with the php redirect check solution in it):
<!DOCTYPE html>
<html>
<head>
<title>Chart Submission Form</title>
<link href="insert.css" rel="stylesheet">
</head>
<body>
<div class="maindiv">
<!--HTML Form -->
<div class="form_div">
<div class="title">
<h2>Insert Data In Database Using PHP.</h2>
</div>
<form action="insert_backend.php" method="POST" enctype="multipart/form-data">
<!-- Method can be set as POST for hiding values in URL-->
<h2>Form</h2>
<label for="uploadedimage">Small image to upload: </label>
<input type="file" name="uploadedimage" id="uploadedimage"/><br />
<label>Date:</label>
<input class="input" name="date" type="text" value=""><br />
<label>Retrace:</label>
<input class="input" name="retrace" type="text" value=""><br />
<label>Start of Swing Trade:</label>
<input class="input" name="start_of_swing_trade" type="text" value=""><br />
<label>End of Swing Trade:</label>
<input class="input" name="end_of_swing_trade" type="text" value=""><br />
<label>Bull flag:</label>
<input class="input" name="bull_flag" type="text" value=""><br />
<label>Bear flag:</label>
<input class="input" name="bear_flag" type="text" value=""><br />
<label>EMA Crossover:</label>
<input class="input" name="ema_crossover" type="text" value=""><br />
<label>Trading Instrument:</label>
<input class="input" name="trading_instrument" type="text" value=""><br />
<input class="submit" name="submit" type="submit" value="Insert">
</form>
<?php
if (isset($_GET['success']) && $_GET['success']) {
echo "New record created successfully";
} else if (isset($_GET['success']) && !$_GET['success']) {
echo "Failed to insert new record";
}
?>
</div>
</div>
</body>
</html>
Updated my PHP code to include the header location:
$sql = "INSERT into charts (charts_URL, charts_date, charts_retrace, charts_start_of_swing_trade, charts_end_of_swing_trade, charts_bullflag, charts_bearflag, charts_ema_crossover, charts_trading_instrument) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
// s = string, i = integer, d = double, b = blob
//preparing statement
$stmt = $conn->prepare($sql);
if(!$stmt){ exit("prepare failed");}
//binding param
$stmt->bind_param('sssssssss',$target_path, $date, $retrace, $start_of_swing_trade, $end_of_swing_trade, $bull_flag, $bear_flag, $ema_crossover, $trading_instrument);
if(!$stmt){ exit("bind failed");}
//will return 0 if fail
if($stmt->execute() != 0){
$success = true;
}else{
$success = false;
}
header('location:insertchart.php?success='.$success);
exit;
}
}
}
?>
The FINAL code (actually a snippet) that made everything work:
if($stmt->execute() != 0){
$success = true;
header('Location:http://mlsinc.net/chart-submission/insertchart.php?success='.$success);
}else{
$success = false;
header('Location:http://mlsinc.net/chart-submission/insertchart.php?success='.$success);
}
}
//close connection
$conn->close();
Try with -
$stmt->bind_param('sssssssss',$target_path, $date, $retrace, $start_of_swing_trade, $end_of_swing_trade, $bull_flag, $bear_flag, $ema_crossover, $trading_instrument);
if(!$stmt){ exit("bind failed");}
//will return 0 if fail
if($stmt->execute() != 0){
$success = true;
}else{
$success = false;
}
header('location:yourform.php?success='.$success);
exit;
On you form page add a check for it -
if (isset($_GET['success']) && $_GET['success']) {
echo "New record created successfully";
} else if (isset($_GET['success']) && !$_GET['success']) {
echo "Failed to insert new record";
}
To show the message on form page
Store the message in session after inserting the row(since you are redirecting page)
I think the soultion suggested by sgt BOSE will work for you. But instead of passing a "success" GET parameter back to your page containing form, you should use a session variable because the $_GET['success'] will re-print the message if user reloads the window.
Once you print the result stored in session variable make sure to unset it.
Ok I see your problem here, it's actually pretty simple.
the way it works is that the message would be declared inside of the script tag
so you should do something like this so it will call the message.
<html>
<head>
<script type="text/javascript">
//Put the javascript function you want the button to do Here
function show_alert()
{
alert("Form Succesfully Submited");
}
</script>
</head>
<body>
<form action="insert_backend.php" method="POST" enctype="multipart/form-data">
<!-- Method can be set as POST for hiding values in URL-->
<h2>Form</h2>
<label for="uploadedimage">Small image to upload:</label>
<input type="file" name="uploadedimage" id="uploadedimage" />
<br />
<label>Date:</label>
<input class="input" name="date" type="text" value="">
<br />
<label>Retrace:</label>
<input class="input" name="retrace" type="text" value="">
<br />
<label>Start of Swing Trade:</label>
<input class="input" name="start_of_swing_trade" type="text" value="">
<br />
<label>End of Swing Trade:</label>
<input class="input" name="end_of_swing_trade" type="text" value="">
<br />
<label>Bull flag:</label>
<input class="input" name="bull_flag" type="text" value="">
<br />
<label>Bear flag:</label>
<input class="input" name="bear_flag" type="text" value="">
<br />
<label>EMA Crossover:</label>
<input class="input" name="ema_crossover" type="text" value="">
<br />
<label>Trading Instrument:</label>
<input class="input" name="trading_instrument" type="text" value="">
<br />
<!--This is where you tell the script where to load the (ID) for example im using a simple message for you what you need to do is make the id im sure you know how to create a simple (ID) inside of a java ,heck im thirteen im about an expert on it if i can do im sure you can! :) :)
anyway inside the div tag make it look like this: <div id=("PUT ID IN HERE") >
then put you function in the script for wha you want it to do hope this helped you have a nice day!-->
<div>
<input class="button" name="submit" type="submit" onclick="show_alert()" value="Submit">
</div>
</form>
</body>
</html>
Hope that this helps if not dont hate lol.