Passing Form Variable to New Window

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
phppick
Forum Commoner
Posts: 57
Joined: Thu Aug 14, 2003 5:59 am

Passing Form Variable to New Window

Post 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>
User avatar
cybaf
Forum Commoner
Posts: 89
Joined: Tue Oct 01, 2002 5:28 am
Location: Gothenburg Sweden

Post 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
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post 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
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post 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;">
Post Reply