Page 1 of 1

Passing Form Variable to New Window

Posted: Sun Jan 25, 2004 7:30 pm
by phppick
Hi

I am having an HTML page like below. When i Click Submit, i want to Va;lidate first and result Form i want to Display in New Window( With out Top Buttons and Address bar) How can i do this??

<html>
<head>
<title>Title</title>
<script type="text/javascript">
function valid()
{

}
</script>
</head>
<body>
<form name="the_form" method="post" action="" onsubmit="return valid();">
<table>

<tr>
<td>User name</td>
<td><input type="text" value="enter user" name="uname" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="text" value="enter password" name="pwd" /></td>
</tr>
<tr><td><input type="submit" value="Login" /></td></tr>
<tr><td> </td></tr>
</table>
</form>
</body>
</html>

Posted: Tue Jan 27, 2004 9:07 am
by cybaf
I'm not quite sure I understood your question, but I'll try to help a little bit.

I think that you should have a search at perhaps google for "form validation script" and then try to build your own validation script from what you find, since it is pretty hard to determine what you would consider a valid form.

Once the validation is done, did you want to submit the data and send it to a new window or did you just want javascript to open a new window and copy the data to a similar form in the new window?

//cybaf

Posted: Tue Jan 27, 2004 9:20 am
by ol4pr0
yea i guess what he means is opening a new window just not full sized.

I guess that would take java to do so.

to have it display again..( in a normal window sinds i do not know alot about java )

Code: Select all

// this is a example you will have to modify it for own use, sinds i 
// copied it from a old script.

$host="";
$uname=''";
$pass="";
$database="";
$tablename="';
$connect= mysql_connect($host, $uname, $pass)
 or die("Cant connect: " .mysql_error());
$result=mysql_select_db($database)
or die(": " .mysql_error());
$query = "INSERT INTO login VALUE('" .$customerid. "', '" .md5($password) . "')";
// $result = mysql_query
if(!$query)
{
 die("Cant execute query: " .mysql_error());
}
?>
<table width="" border="" align="" cellpadding="" cellspacing="">
<tr>
<td colspan="" bgcolor="">
<div align=""><NEW PASSWORD ENTERD<?php echo $customerid;?>

// and so on..

<div align=""> PASSWORD</div>
</td>
<td>
<center>
<?php echo $password; ?>

// and so on
hope this made any sence

Posted: Tue Jan 27, 2004 10:24 am
by xisle
There is a huge difference between Java and Javascript.
Java is a compiled laguage like C++, Javascript is interpreted by the web browser.

Here is JS to open a new window...

Code: Select all

<A href="" onClick="window.open('formname.php','windowname','toolbar=0,
menubar=0,scrollbars=1,resizable=1,width=300,height=300'); 
return false;">