View Full Version : Can this be done? <---noob
Im currently messing around with HTML and was wondering if there was a way (using a <form>) that I can send data from one window to another when I submit.
Can you do something like <form action="URL"? and then how do you display these values?
Patriarch
10-01-03, 06:56 PM
Im currently messing around with HTML and was wondering if there was a way (using a <form>) that I can send data from one window to another when I submit.
Can you do something like <form action="URL"? and then how do you display these values?
I think a scripting language like PHP would best be suited for a task like this.
I suppose you could play around with a solution using the "get" method in HTML, or JavaScript, but that's messy, complex, and probably won't work in all browsers.
Im currently messing around with HTML and was wondering if there was a way (using a <form>) that I can send data from one window to another when I submit.
Can you do something like <form action="URL"? and then how do you display these values?
If you mean something like click a link and have the new page open in a another window, you could use an Iframe the link would use a target=i_frame in the anchor tag.
If youre using a form, you can do someting similair. It doesnt send the data to a new window, but the page that the action is sent to can be sent to a new window, ex. <form action=something.ext method=post target=i_frame>
Hope that helps a little.
kingofkellys
10-09-03, 12:17 AM
Getting values in another form could be done by using Post and Get Protocols.... As said by our friends u could use Php or Asp... When Values reach the destination page care should be taken in both php and asp for getting or retrieving these values as it differs in methods for Post and Get in various ways... Thus the form's protocol = Method...(get or post) and the Action = destination_filename are important to....
Ba bye
stylishdave
11-21-03, 08:42 AM
here is an example just russtled up for u, the proccessing form will be written in PHP
create a form called wotever.htm and copy the following code into the body section of the html/xhtml document :
<form method="post" action="process.php">
<table cellpadding="3" cellspacing="3">
<tr>
<td>First Name:</td><td>
<input type="text" name="forename" size="20" /></td>
</tr>
<tr>
<td>Surname:</td><td>
<input type="text" name="surname" size="20" /></td>
</tr>
<tr>
<td><input type="submit" value="submit" name="submit" /></td>
</tr>
</table>
</form>
now create another document and call it process.php copy and paste the following code into the document
<?php
/* if you are using the GET method to pass the vars then change POST to GET */
$fore=$_POST['forename'];
$sur=$_POST['surname'];
/*Now test for the var submit using an if function*/
if ($submit){
echo "Your first name is $fore and your second name is $sur";
}
else { echo "Test for var submit failed";
}
?>
and there u go passing vars from a html doc and displaying them using PHP.
hope this helps.
XMLMania.com
11-22-03, 07:31 AM
You want the easiest and fastest way of doing this?
Then try this:
PHP:
<?
header("Location: $myUrl");
?>
Put this inside your web page:
<form action="go.php">
<select name="myUrl" size="1">
<option value="http://www.xmlmania.com" selected="selected">XMLMania.com</option>
<option value="http://www.microsoft.com">Microsoft.com</option>
</select>
<input type="submit" value="Go" />
</form>
- Martin
stylishdave
11-22-03, 07:53 AM
if not familiar with PHP then here is similar javascript rendition.
<html>
<head>
<title>passing vars</title>
<script type="text/javascript">
function passingvars(form) {
var me=form.fore.value;
var meto=form.sur.value;
document.write("your forename is: " + fore + "<br />your surname is: " + sur);
}
</script>
</head>
<body>
<form method="post">
<table cellpadding="3" cellspacing="2">
<tr>
<td>forename:</td><td><input type="text" name="fore" /></td>
</tr>
<tr>
<td>surname:</td><td><input type="text" name="sur" /></td>
</tr>
<tr>
<td><input type="submit" onclick="passingvars(this.form)" value="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
stylishdave
11-22-03, 02:14 PM
sorry just spotted an error where the var names are,
change the following were i put
var me=form.fore.value;
var meto=form.sur.value;
change those too:
var fore=form.fore.value;
var sur=form.sur.value;
sorry about this, i cut and pasted the code from a document i had created then changed the settings, but forgot about the var names.....
vBulletin® v3.6.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.