Jump to content

phpQuestioner

Members
  • Posts

    1,485
  • Joined

  • Last visited

    Never

Everything posted by phpQuestioner

  1. Well here is the javascript side of it; you will have to get someone else to help you with the php side, to tired too get into that tonight. I suggest posting a question regarding this type of form processing in the PHP forum on this site. Which Is Located Here: http://www.phpfreaks.com/forums/index.php/board,1.0.html Here's You JavaScript: <script language="javascript"> var i = 0; function addMore() { i=i+1; document.getElementById("fields").innerHTML += "\nItem "+i+": <input type=\"text\" name=\"saleitem"+i+"\"><br><br>" } window.onload = function() { addMore(); } </script> <div id="fields"></div> <br/><br/> <input type="button" value="Add Another Sale Item" onclick="addMore()"> Good Luck
  2. when I submit the form it does; don't submit the page back to itself or you will keep getting the confirm prompt. if your going to submit the page back to itself; you need to dynamically change the "occured" variable to "yes" or something else completely. do something like this: <script language="javascript"> var occured="<?php if (isset($_POST['submission'])) { echo "yes"; } else { echo "no"; } ?>"; function ucantgoyet() { if (occured == "no") { confirm("Please Stay!"); document.location = document.URL; } } </script> </head> <body onunload="ucantgoyet()"> <form name="form1" action="somepage.php" method="post"> <input type="submit" name="submission" value="Submit" onclick='occured="yes"; return true'> </form>
  3. Awesome - I'm glad I got it working for you
  4. here is another version; I tricked this one out - pimped my script - lol <script language="javascript"> var presently = document.URL; var thisFile = presently.split("/"); var thisExt = presently.split("."); var total = thisFile.length - 1; var totaled = thisExt.length - 1; var getEXT = thisExt[totaled]; function getFileNameAndExt() { if (getEXT == "htm" || getEXT == "html" || getEXT == "php" || getEXT == "pl") // add more file types as needed { document.getElementById('viewIt').innerHTML = thisFile[total] + '<br/><br/>'; } else { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } } </script> <div id="viewIt"></div> <a href="javascript:void(0)" onclick="getFileNameAndExt()">Where Am I At? - Click Here To Find Out</a> man I must be bored - lol
  5. alright, try this - I think I just rehashed something I already did; but try it anyway - lol <script language="javascript"> var presently = document.URL; var thisFile = presently.split("/"); var thisExt = presently.split("."); var total = thisFile.length - 1; var totaled = thisExt.length - 1; var getEXT = thisExt[totaled]; function getFileNameAndExt() { if (total > "3") { document.getElementById('viewIt').innerHTML = thisFile[total] + '<br/><br/>'; } else if (getEXT != "htm" || getEXT != "html" || getEXT != "php" || getEXT != "pl") // add more file types as needed { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } else { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } } </script> <div id="viewIt"></div> <a href="javascript:void(0)" onclick="getFileNameAndExt()">Where Am I At? - Click Here To Find Out</a>
  6. yeah, I found a bug in the script; I am taking a look at it now.
  7. Try this then: <script language="javascript"> var presently = document.URL; var thisFile = presently.split("/"); var thisExt = presently.split("."); var total = thisFile.length - 1; var totaled = thisExt.length - 1; var getEXT = thisExt[totaled]; function getFileNameAndExt() { if (total > "3") { document.getElementById('viewIt').innerHTML = thisFile[total] + '<br/><br/>'; } if (getEXT != "htm") { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } else { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } } </script> <div id="viewIt"></div> <a href="javascript:getFileNameAndExt()">Where Am I At? - Click Here To Find Out</a> I would like to make this sucker work - lol
  8. try this; I thought I would give this one more shot <script language="javascript"> var presently = document.URL; var thisFile = presently.split("/"); var thisExt = presently.split("."); var total = thisFile.length - 1; var totaled = thisExt.length - 1; var getEXT = thisExt[totaled]; function getFileNameAndExt() { if (total > "3") { document.getElementById('viewIt').innerHTML = thisFile[total] + '<br/><br/>'; } else if (getEXT != "htm" || getEXT != "html") // you can keep adding web page extensions as needed { document.getElementById('viewIt').innerHTML='index.htm'; } else { document.getElementById('viewIt').innerHTML='index.htm'; } } </script> <div id="viewIt"></div> <a href="javascript:getFileNameAndExt()">Where Am I At? - Click Here To Find Out</a>
  9. Also, after looking at you example; if you are not using htacess file to change your urls into sub-directory urls (so to speak) - then even if you type: "http://www.4tenonline.com/createDatabase/" - you should automatically be redirected to: "http://www.4tenonline.com/createDatabase/index.htm". The only way the url will continuously stay in sub-directory format (without showing the file or extension); is if you have changed your htaccess file or if you are using a script or service to mask the url.
  10. you still didn't do it like I was telling you to; do it like this: <script language="javascript"> function checkZIP() { var zippy = document.getElementById('zipcode').value.length; if (zippy < "5") { alert("Please Enter A Valid Zip Code"); } else { document.search.submit(); } } </script> <form action="index.php" method="get" name="search" onsubmit="checkZIP(); return false"> <table border="0" cellpadding="3" cellspacing="2"> <tr> <td align="right">Zipcode: <input name="zipcode" id="zipcode" type="text" class="textbox" size="8" maxlength="5"/></td> <td><input type="button" value="Click to Get Gas Prices" onclick="checkZIP();dosearch(this.form)"/></td> </tr> </table> </form>
  11. yes; that was the original function that I made.
  12. try checking the strings length. you can encode the html characters; if needed.
  13. Try setting the min-width for the div or html element that contains that image. I didn't look at the html or css; but I'm sure it is a coding error on there part.
  14. try this: <script language="javascript"> var occured="no"; function ucantgoyet() { if (occured == "no") { confirm("Please Stay!"); document.location = document.URL; } } </script> </head> <body onunload="ucantgoyet()"> <form name="form1" action="somepage.php" method="post"> <input type="submit" value="Submit" onclick='occured="yes"; return true'> </form>
  15. your not adding the onsubmit() event to the form tag. onsubmit="checkZIP(); return false"
  16. well I am not going to change my domain forward page for this either - sorry - lol. I am not sure why it's not working; I suggest just keep toying with the script I provided you or look into a server side method of doing this. good luck
  17. yeah, but the else if statement should handle that and I am not quit sure why it is not. do you have a live demo is this; so I can try to replicate this issue? if so, post a link here and let me take a look at it.
  18. and the code I give you above does just that.
  19. do this then: <script language="javascript"> function checkZIP() { var zippy = document.getElementById('zipcode').value.length; if (zippy < "5") { alert("Please Enter A Valid Zip Code"); } else { document.zipform.submit(); } } </script> <form name="zipform" action="gasfinder.php" method="post" onsubmit="checkZIP(); return false"> Zip Code: <input type="text" name="zip" id="zipcode" maxlength="5"> <input type="button" value="Get Gas Now!" onclick="checkZIP()"> </form>
  20. here is my advice; since this is a third party script, go to the site where you found it and try to find the author's directions. they usually give you an example/tutorial or instructions on how to implement their scripts. good luck
  21. if you have your htacess file set where it changes your extensions in sub-directory urls; then it's not going to work. example: before htacess change http://www.domain.com/whatever.php after htacess change http://www.domain.com/whatever/
  22. it's called a "lightbox" - google it for tutorials and examples.
  23. you never answered my question; that example show you how to do this.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.