Jump to content

PHP Form


mcmuney

Recommended Posts

I'm trying to figure out the direct url of the form result page. The code below returns the form results; however, the url remains unchanged. For example, on domain.com, on submit, it remains as domain.com, but it returns form results. I'd like to know the direct path of the result page. I've tried domain.com/index.php?url=abc.com and a few others, but none work.

 

<script type="text/javascript">
function validate_url(o,e){
//var patu = /^(((ht|f)tp(s?))\:\/\/)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+(\.[a-zA-Z]{2,4}){1,2}(\:[0-9]+)*(\/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$/i;
//var patd = /^[a-zA-Z][a-zA-Z0-9]+(\.[a-zA-Z0-9]+)+$/i;
var patu = /^(((ht|f)tp(s?))\:\/\/)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+(\.[a-zA-Z]{2,4}){1,2}(\:[0-9]+)*(\/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$/i;
var patd = /^[a-zA-Z0-9][a-zA-Z0-9]+(\.[a-zA-Z0-9]+)+$/i;	
R=$("#frm1url").val();
if(R && R.length>0 && R.match(patu)!=null){
	return true;
}else if(R && R.length>0 && R.match(patd)!=null){
	return true;
}else{
	alert("Invalid url entered");
	return false;
}
}
</script>
<form action="index.php" method="post" onsubmit="return validate_url(this,event)" style="padding:0px;margin:0px;">
<div id="search" style="padding:20px; width: 700px;">
<input class="input" type="text" name="url" id="frm1url" size="52" style="padding:5px;" value="Enter domain name or web page address" onblur="if (this.value == '') {this.value = 'Enter domain name or web page address';}"  onfocus="if (this.value == 'Enter domain name or web page address') {this.value = '';}">
</div>
</form>

Link to comment
https://forums.phpfreaks.com/topic/118573-php-form/
Share on other sites

there are several ways to get form data with javascript, when using method=get (default if you just remove the "method" statement from the form tag) you can take location.url, split it at "?", take the second value and split it at "&", then take each value seperately, split them at "=" limitting to 1 split and parsing those values into variable=value... and in method=post with SOME webservers javascript can do a request(ID)  to get the value (such as on the first page <input type=text id=username> and on the second page <script> vart user = request('username');document.write("Hello there " + user); </script>

 

 

hope this helped... theres form validation for method=get on javascriptkit.com i think.

Link to comment
https://forums.phpfreaks.com/topic/118573-php-form/#findComment-611375
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.