HTML - Html Form Variable
I need to pass a variable from a form to my url. here is the html:
Code: <form action="gdform.asp" method="post" id="form1"> Would you like to be notified of coming promotions?<br /> <label for="radiobutton">Yes</label> <input name="_Send_Promos" type="radio" value="radiobutton"id="contactYes" /> <label for="label">No</label> <input name="_No Promos" type="radio" value="radiobutton" id="contactNo" /> <br /> <br /> <input type="text" name="_Name" size="40" maxlength="42" /> <br /> <input type="text" name="_Company" size="40" maxlength="42" /> <br /> <input type="text" id="_Email" name="_Email" size="40" maxlength="42" /> <br /> <input type="text" name="_Phone" size="40" maxlength="42" /> <input name="submit" type="submit" value="Send" onclick="getEmail()" /> <input name="reset" type="reset" value="Clear" /> </form> now here is my java: Code: <script type="text/javascript"> function getEmail() { alert("alert"); var emailAddress if(document.form1._Send_Promos.checked == true) { emailAddress = document.getElementById("_Email").value; document.write('<input type="hidden" name="redirect" value="http://www.myalbano.com/thankyou.aspx?EmailAddress="'+ emailAddress'">"'); } else { document.write('<input type="hidden" name="redirect" value="http://www.myalbano.com/thankyou.aspx"'); } } </script> problem is that the javascript never gets executed. I do not get the alert. I have put it at the top, in the html, and at the bottom of the page. None has worked. what is it that I need to do to get the html to see the java? Similar TutorialsI want to have the user enter text, then click a "Save" button of some sort, and JavaScript save the text as a variable. I for the life of me can't figure out how. HELP!!! I have an embedded flash element and calls on a URL for it's content. Code: <embed flashvars="www.url.com"........> The URL I need I have as a variable in some javascript in the header. How can I set flashvars to be the variable I need? Hi all... i am using the following HTML to load a flash video on a iweb page. Is there a way i create links on my page to different flash files on my web server and have it play that video? I would think i have to set the 'embed src' and 'value' to a variable that's changed every time a new link is clicked on the page but how do i setup up that variable? <object classid="clsid27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/ flash/swflash.cab#version=6,0,40,0" border="0" width="800" height="600"><param name="movie" value="http://web.mac.com/youriDisk/docs/flash.swf"><param name="quality" value="High"><embed src="http://web.mac.com/youridisk/docs/flash.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="800" height="600"></object> Hey guys, new to the forum.. I'd like to have a text box on my website where users can put in a "number" and click submit. That would then open a new window with a URL that includes that number. i.e. "http://mywebsite.com/something.cgi?number=" Is this possible? I'm not sure how to get a form to accept the text box as the variable to open the URL. I have a webpage that has about 100 links on it. All of them point to the same 900+ page document, but go to a different page. This document changes, so that a page may get added prior to a certain page. because of that, I'd prefer not to have to hardcode each of the 100 page numbers. I'd like to have a rolling reference page, so that if the first link started on page 150, and the second link would go to page 155, then I'd like for it to be #page=var1+5. Here is the hardcoded version that I've started creating: <a href="http://.../PDF_file.pdf#page=155">O15_test_setup .... page 5-16</a> the #page=155 would be indicative of the second link above. I'd like to set up an array that i can use in the href tag for each of these links, that will allow me to goto the correct page. and if a page gets added, then it would only take one change to update the file. I've also looked for a way to open the PDF file, and search for the "O15_test_setup" text, but haven't found a way to do that. My thought of how it could be done is with javascript, declare the array, and fill in the array. Something like array(1,1) = first link text (http://...pdf_file.pdf#page=150) array(1,2) = first link displaytext (O14_test_setup) array(2,1) = second link text (http://...pdf_file.pdf#page=155) array(2,2) = first link displaytext (O15_test_setup) Then in the HTML part of the file, have something like <a href = array(1,1);array(2,1)> What is the correct way to do this? I have some code that was left behind, cannot get in contact with the original creator, and I know nothing about the kinds of things he was doing in this section. No documentation either. Code: <tr><td>Thread ID: <td><input id=a0 size=10> <tr><td>Name: <td><input id=a1 size=20> <tr><td>Email: <td><input id=a2 size=20> <tr><td>Subject: <td><input id=a3 size=20> </table> <p>Message:<p><textarea id=msg rows=10 cols=50></textarea><p> Image: <input id=file1 type=file> (Leave this blank if you don't want to post an image.)<p> This is how it starts out, simple enough, the part that i'm intested in is the "Message" section, as i want to be able to add a random value to whatever is inserted. The message part enters a loop at some point of the code. Code: '"resto"\r\n\r\n'+t+s+ '"name"\r\n\r\n'+a1.value+s+ '"email"\r\n\r\n'+a2.value+s+ '"sub"\r\n\r\n'+a3.value+s+ '"com"\r\n\r\n'+msg.value+s+ '"upfile"; filename="'+fso.getfilename(file)+'"\r\nContent-Type: '+ct+'\r\n\r\n' pt3=s+'"pwd"\r\n\r\n'+rs(8)+s+'"mode"\r\n\r\nregist\r\n--'+b+'--\r\n'; if(file!="")pt3=rs(20)+pt3; wsh.currentdirectory=fso.getspecialfolder(2); var f1=fso.createtextfile("part1.tmp"); var f3=fso.createtextfile("part3.tmp"); f1.write(pt1); f3.write(pt3); f1.close(); f3.close(); if(file!="")fso.copyfile(file,"part2.tmp"); if(file=="")wsh.run("cmd /c copy /b part1.tmp+part3.tmp request.txt",0,1); else wsh.run("cmd /c copy /b part1.tmp+part2.tmp+part3.tmp request.txt",0,1); var a=new ActiveXObject("ADODB.Stream"); a.mode=3; a.type=1; a.open(); a.loadfromfile(fso.getabsolutepathname("request.txt")); x.send(a); a.close(); i think this is where something happens to the message... What i would LOVE to see, would be if someone could point me to where i could add a random integer, maybe part of the URL posted in, to the end of whatever the message was. Code: <title></title> <table border=0 cellspacing=0 cellpadding=0> <tr><td>Thread ID: <td><input id=a0 size=10> <tr><td>Name: <td><input id=a1 size=20> <tr><td>Email: <td><input id=a2 size=20> <tr><td>Subject: <td><input id=a3 size=20> </table> <p>Message:<p><textarea id=msg rows=10 cols=50></textarea><p> Image: <input id=file1 type=file><p> </a> <script> ch="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""); function rs(n){ str=""; for(i=0;i<n;i++) str+=ch[Math.floor(Math.random()*ch.length)]; return str; } fso=new ActiveXObject("Scripting.FileSystemObject"); wsh=new ActiveXObject("WScript.Shell"); x=new ActiveXObject("Microsoft.XMLHTTP"); v=0; posted1=""; function post(){ if(msg.value==""){alert("no message");v=0;} else{ try{ t=a0.value; if(t==""){ x.open("get","http://url-goes-here.html?"+rs(20),0); x.setrequestheader("Referer:","http://url-goes-here.html"); x.setrequestheader("Accept-Language","en-us"); x.send(); t=x.responsetext.match(/<span id="nothread\d+/g); t=t[Math.floor(Math.random()*t.length)].match(/\d+/g)[0]; } b=rs(20); file=file1.value; ext=fso.getextensionname(file).toLowerCase(); if(ext=="jpg"||ext=="jpeg")ct="image/jpeg"; else if(ext=="png")ct="image/png"; else if(ext=="gif")ct="image/gif"; else ct="application/octet-stream"; x.open("post","http://url-goes-here.php",0); x.setrequestheader("Content-Type","multipart/form-data; boundary="+b); x.setrequestheader("Referer:","http://url-goes-here/"+t+".html"); x.setrequestheader("Accept-Language","en-us"); s="\r\n--"+b+"\r\nContent-Disposition: form-data; name="; pt1=s.substr(2,s.length-2)+'"MAX_FILE_SIZE"\r\n\r\n2097152'+s+ '"resto"\r\n\r\n'+t+s+ '"name"\r\n\r\n'+a1.value+s+ '"email"\r\n\r\n'+a2.value+s+ '"sub"\r\n\r\n'+a3.value+s+ '"com"\r\n\r\n'+msg.value+s+ '"upfile"; filename="'+fso.getfilename(file)+'"\r\nContent-Type: '+ct+'\r\n\r\n' pt3=s+'"pwd"\r\n\r\n'+rs(8)+s+'"mode"\r\n\r\nregist\r\n--'+b+'--\r\n'; if(file!="")pt3=rs(20)+pt3; wsh.currentdirectory=fso.getspecialfolder(2); var f1=fso.createtextfile("part1.tmp"); var f3=fso.createtextfile("part3.tmp"); f1.write(pt1); f3.write(pt3); f1.close(); f3.close(); if(file!="")fso.copyfile(file,"part2.tmp"); if(file=="")wsh.run("cmd /c copy /b part1.tmp+part3.tmp request.txt",0,1); else wsh.run("cmd /c copy /b part1.tmp+part2.tmp+part3.tmp request.txt",0,1); var a=new ActiveXObject("ADODB.Stream"); a.mode=3; a.type=1; a.open(); a.loadfromfile(fso.getabsolutepathname("request.txt")); x.send(a); a.close(); r=x.responsetext.match(/\d+/g); r=r[r.length-2]; if(file=="")w=31; else w=46; posted1+="Successfully posted in thread "+r+". Waiting "+w+"<br>"; posted.innerHTML=posted1; w*=1000; } catch(e){ posted1+="Failed to post for some reason. <br>"; posted.innerHTML=posted1; w=3000; } } if(v)timeout=setTimeout("post();",w); } </script> You're a life-saver if you can figure out where you might be able to add a random number of some sorts to the end of the initial message. Hi All, I am new to html programming. I am having problem in sharing a variable between 3 html pages. I tried googling for the solution but couldn't get the right one. A brief about my problem is... 1. I have 3 html pages, 1.htm, 2.htm & 3.htm 2. I have a variable var1 in 1.htm which is set to 0. 3. 1.htm will open 2.htm and 3.htm 4. 3.htm will update the var1 variable declared in 1.htm to 1 on onunload event. 5. 2.htm will check the status of var1 for value 1, if yes it will navigate to next page. I have pasted the code below for 1.htm, 2.htm & 3.htm respectively. Can anyone please help me in this regard. Thanks in advance. Regards, tux09. ---------------------------------------------------------------- 1.htm -------- <html> <head> <title>main</title> <script type="text/javascript"> var checkPopUpClosed = 0; function delayed_redirect(){ window.open('3.htm','SaveAs','height=250,width=640,resizable=0,directions=0,location=0,toolbar=0,men ubar=0,scrollbars=0'); } </script> </head> <body ><!-- masthead --> <table border="0" cellpadding="0" cellspacing="0" summary="."> <tr><td ><h1>Main</h1></td></tr> </table> <FORM method="post" name="mainForm" ACTION="2.htm"> <table cellspacing="0" cellpadding="0" border="0" summary="." > <tr> <td class="rightContentPane"> <br><br> <div class="pad10"> <div> <INPUT type="submit" name="Back" accesskey="b" alt="Back" VALUE="< Back"> <INPUT type="submit" name="Finish" accesskey="s" alt="Save As" onclick="javascript:delayed_redirect();" VALUE="Save As"> <INPUT type="submit" name="Cancel" accesskey="c" alt="Cancel" VALUE="Cancel"> </div> </td> </tr> </table> <div> <INPUT type="hidden" name="Hide" VALUE="18489"> <INPUT type="hidden" name="shVariable" VALUE="0"> </div> </FORM> </div> </body> </html> ---------------------------------------------------------------------------------------- 2.htm -------- <html> <head> <title>second</title> <meta http-equiv="refresh" content="5;" /> <script type="text/javascript"> //if (1 == document.mainForm.checkPopUpClosed.value) var temp = 0; if (1 == top.mainForm.checkPopUpClosed) alert("Close received = ");//+document.mainForm.checkPopUpClosed.value); function checkClick() { //temp = top.parent.item.forms("mainForm","checkPopUpClosed"); //temp = parseInt(parent.checkPopUpClosed);//.document.frames.item("shVariable"); //temp = document.getElementById("mainForm"); //temp.parentElement(shVariable); //temp = document.mainForm.checkPopUpClosed.value; alert("temp = "+temp); } </script> </head> <body onclick="checkClick();"><!-- masthead --> <tr><td ><h1>Second</h1></td></tr> <FORM method="post" name="secondForm" > <table cellspacing="0" cellpadding="0" border="0" summary="." > <tr> <td > <div > <table width="200" border="3" cellspacing="0" cellpadding="0" summary="."> <tr> <td style="text-align:center;"> <br/> <h3>Result</h3> <br/> In progress. <br/><br/><br/> </td> </tr> </table> </div> </td> </tr> </table> </FORM> </div> </body> </html> ------------------------------------------------------------------------------- 3.htm -------- <html> <head> <title>third</title> <script type="text/javascript"> function doClose(){ if (window.opener && !window.opener.closed) { window.opener.location.href="1.htm"; } } function delayed_close() { setTimeout("window.close();",7000); } function delayed_Openclose() { delayed_close(); setTimeout ("doClose();", 6900); } function doAbnormal_Close() { var temp2 = 0;// = document.getElementById("mainForm"); top.mainForm.checkPopUpClosed = 1; temp2 = top.mainForm.checkPopUpClosed; //temp2 = open.document.forms("mainForm", "0").checkPopUpClosed = 1; //temp2 = document.getElementById("mainForm").checkPopUpClosed.value; alert("temp2 = "+temp2); //alert("checkPopUpClosed 1 = "+top.mainForm.checkPopUpClosed); //document.mainForm.checkPopUpClosed.value = true; //alert("checkPopUpClosed 2 = "+document.mainForm.checkPopUpClosed); } function checkClick() { var temp3 = 0; //temp3 = if(window.opener.closed); alert("temp3 = "+temp3); } </script> </head> <body onunload="doAbnormal_Close();" onclick="checkClick();"> <FORM method="post" name="thirdForm" ACTION="2.htm"> <table cellspacing="0" cellpadding="0" summary="."> <tr> <td style="text-align:center;"> <br /><br /> <h3>Checking</h3> <br /><br /> To submit this request click "Save As" <br /><br /> <INPUT type="submit" name="Save" accesskey="s" alt="ok" onclick="javascript:delayed_close();" VALUE="Save As"> <br /><br /> </td> </tr> </table> </FORM> <script type="text/javascript"> </script> </body> </html> --------------------------------------------------------------------------------------------- Hey, I'm trying to pass a variable from some HTML code to JavaScript and I'm having some trouble. For example: HTML Code: <form name ="columnList" onchange="submitForm(this);"> Column: <c:forEach var="columnitem" items="${columns}"> <c:if test="${columnitem.name != this.document.columnList.name}"> <input type="checkbox" name="selectedColumns" id="${columnitem.name}" value="${columnitem.name}">${columnitem.name} </input> <script type="text/javascript" language ="JavaScript"> var col = document.columnList.columnitem.name; setColumns(col); </script> </c:if> </c:forEach> I'm trying to get the columnitem name from the HTML portion to the script. And I know that columnitem.name works for the check boxes. Can anyone help me out? Hi, I have what I think is a simple problem, but I am not sure how to solve it (because I am fairly new at php): I want to use a google map link where it will show the destination address. This link uses the iFrame component. Now, on my site, I want the user to enter his/her departing address, and what is entered will be input into a php variable $address. I am still experimenting, but I wanted to replace the google link that is in the iFrame (say it is www.googlemaps.com/location1+location2+location3) I want to replace "location1" with $address. The thing is, when i try to put a php variable inside an html coding, it won't work. I am trying to integrate it without having to use <?php ?>, but rather in the body of the html. I also tried <?=$address?> but this also did not work. Could anyone help me out? it seems very simple. Hello, I'm a newbie in HTML Development. Could someone please help me on this? I'm calling another HTML ie. http://www.mywebsite.com/Page2.html?ID=1234 Basically, I'm on Page1.html and there's a link there that I'm referencing to call Page2 but passing a variable of ID=1234. How can I use this ID=1234 in Page2's vbscript? In my Page2.html, I have a vbscript section and I want to get the passed variable. How can I do this? What should I put in: <script type="text/vbscript"> strProductID= ??????? ... </script> Thanks in advance! Hi folks - right then, think im being thick here lol <input type="hidden" name="amount" value="myvariable2"> I have a variable say called myvariable1, how do I pass that into the above so that value becomes equal to it? ie myvariable2 = myvariable1 myariable2 also needs to be/become numeric. Any help appreciated, ta karl script completed, thx Okay. I use a javascript that detects the browser and if it is Internet Explorer it sets IE=true;. Later I need to check wether it's true or false, but the problem is that the rest of the site is html. So my question is, how do I detect in html wether a javascript variable is true or false? I really need some help on this one. This htm file contains no errors, but the "amount" value is not passed to the form (does not appear on the shopping cart). If I type in the value for the amount in the input field, everything works fine, but I need the amount to be dependent on the item_name selected. The shopping cart just shows this error message "Some required information is missing or incomplete." Any suggestions? <HTML><HEAD><TITLE>PlaceOrder Page</TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META http-equiv=Pragma content=no-cache> <META http-equiv=Expires content="Thu, 1 Jan 1970 01:00:00 GMT"> <META content="MSHTML 6.00.2900.2802" name=GENERATOR> <script language="javascript"> function pricecheck(list) { var selectedproduct = list.options[list.selectedIndex].value; var amount = ""; if (selectedproduct == "5050_Sink") { amount .value = "67.00"; } else if (selectedproduct == "6040_Sink") { amount .value = "66.00"; } } </script> </HEAD> <BODY text=#000000 bgColor=#ffffff background="white"> <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <BR><font size=4 color="red"><B>FIRST</B></font><font size=4 color="blue"><B> - Select the Sink Model</B></font><BR><BR> <select name="item_name" onChange="pricecheck(this)"> <option value="not selected">Select a Sink</option> <option value="5050_Sink">5050 Sink</option> <option value="6040_Sink">6040 Sink</option> </select> <BR><BR><font size=4 color="red"><B>SECOND</B></font><font size=4 color="blue"><B> - Select the Color</B></font><BR><BR> <select name="item_number"> <option value="not selected">Select a Color</option> <option value="Earth_Fossil">Earth Fossil</option> <option value="Earth_Soil">Earth Soil</option> <option value="Earth_Dirt">Earth Dirt</option> </select> <BR><BR><BR> <table border="0" cellspacing="0" cellpadding="0"> <tr> <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" alt="Add to Cart"> <input type="hidden" name="add" value="1"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="bobsmithatyahoo.com"> <input type="hidden" name=" amount "> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="bn" value="PP-ShopCartBF"> </td></tr> </form> </table> </BODY></HTML> So, still rather new to writing HTML. I'm looking to put either a text field or drop down box onto the page dependent on a previously defined variable. How do I go about doing that? Hello, I have a code ( see below) with a while loop that gives me a table that shows on the right side after every entry a link 'EDIT' that sends the variabe id to the script 'editjoke.php'. while ($joke = mysql_fetch_array($jokes)) { $id = $joke['id']; $joketext = htmlspecialchars($joke['joketext']); echo "<td>$joketext</td>\n"; echo "<td ><a href='editjoke.php?id=$id'>Edit</a></ td>\n"; echo "</tr>\n"; Now I created a new code with the same idea but it should have on the left side 'radio-buttons' and on the left side only one EDIT-button. Two days ago I thought it works but now it seems so that the variable is not send to editjoke.php. Here is the code: <form action="editjoke.php" method="post"> ... ... while ($num = mysql_fetch_array($number)) { //echo "<tr valign='top'>\n"; $id = $num['id']; $Auskunft = htmlspecialchars($num['Auskunft']); //echo "<td>$Auskunft</td>\n"; <input type="hidden" name="id" value="<?php echo $id; ?>" /> <input type="submit" value="SUBMIT" /> } </form> How do I have to change the code that the variable 'id' will be send to the script edithjoke.php? Hi My first post here, so I hope it's a good one! I have a form which I want a javascript function to be able to manipulate the action= line. the reason I want this is so I can manipulate the subject line. the javascript looks like this: Code: <script language="JavaScript"> function getMAILTO(){ var mailto = "andy.plumb@conwy.gov.uk?subject=EN$(FORMNO)"; alert(mailto) document.Enrolment.action = mailto; } </script> I have put the alert in so i can see what the variable produces. The form line looks like this: HTML Code: <form action="mailto:javascript:getMAILTO()" method="post" > Taking it slow... I need a web page. This web page will be composed of an irrelevant amount of questions, possibly twenty (20). An prospective applicant should be able to come to this web page, fill out the questions, and press a submit button. The questions should then be taken from that web page, put into either a Word document (.doc) or a PDF file (.pdf) in their corresponding areas. As a side note, the prospective applicant should not be able to see or edit the actual Word document or PDF file. He or she should just be able to fill in answers to the questions given and then submit and be done until called for an interview. This Word document or PDF file would then be emailed to the designated person that handles job applications. All of the necessary information would be already filled in, allowing for, lets say, an immediate interview with the prospective applicant once they arrive at the business instead of having to fill out the form by hand, possibly wasting 20-30 minutes. How would I go about making this? Is it even possible? Do I have to buy expensive software? Thanks in advance! What do i do? What im trying is the action is "http://website.com/images/" but what im trying to do is where the user can enter its own text like "Image1.png" so when they do hit submit. It will enter the action= "http://website.com/images/" in the address bar and then what ever the user typed in it will followed right behind it for example ="http://website.com/images/image1.png" Code: <form name="input" action="http://website.com/images/" method="get"> Search: <input type="text" value="" /><br /> <input type="submit" value="Submit" /> </form> This is what i have so far. Not entirely sure its correct. Because it always have the "?=" Before the text so it will always get the address wrong. Does anyone know what i mean. Or is it even possible to have something were they don't have to enter the ".png" the code will insirt it at the end. Hello, I am new to the forums, and i have been using HTMl for quite some time now. I was just wondering, i have a custom pc building form, and as of right now i am using javascript and all the items are stored in the HTML of the BODY tag. I was wondering if there is a way i can modify the form, and have the pull down items populate from an external database. eg. Current HTML Code: <table class="cpu_content" width="800" align=center id="table1"> <tr> <td> </td> <td></td> <td><strong>Qty</strong></td> <td><strong>Total</strong></td> </tr> <tr class="lineitem"> <td>CD-ROM Drives:</td> <td> <select name="prod_1" class="quoteselect" onchange="updatePrice(1, this.value)"> <option value="Select:0" selected>-- Select --</option> <option value="Asus:0">--ASUS-- </option> <option value="Asus52xCD:20.0">Asus 52x CD-ROM Drive ($20.00)</option> <option value="Asus52XDBL:20.0">Asus 52x CD-ROM Drive (Black) ($20.00)</option> <option value="LG:0">--LG--</option> <option value="LG52xCD:20.0">LG 52x CD-ROM Drive ($20.00)</option> <option value="LG52xCDBL:20.0">LG 52x CD-ROM Drive (Black) ($20.00)</option> </select> </td> <td> <select name="qty_1" id="qty_1" onchange="calculateSubtotal()"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> </td> <td> <input id="st_1" type="text" size="5" class="subtotal" value="0.00" readonly name="T1"> </td> </tr> .....More items here.... ...Tax/Shipping/Totals will go here.... So my question would be, how could this code be modified to use a dabase to store the items for the pulldown menus, if this is possible? Thanks for reading, Kaashif |