Help - Search - Members - Calendar
Full Version: HTML form 'has no action'?
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
rbbenson
the system configuration is a Dell laptop, IIS7 installed & working, PHP5 installed and accessable and Rapid PHP 2007 is the 'code editor' with Vista Business as the OS.

The HTML file containing the code for the form fails to pass the variables onto the recieving .php file. This recieving .php file is called by the line <form action="handle_form.php" method="post"> but rather than placing the data assigned to the variables in the recieving .php file and displaying this file in the browser, the recieving file is 'opened to the clipboard'.

Not too sure about this.

Yet, when both files are resident in the code editor, each can be vies in the browser MSIE seperately and when the HTML file calls the .php file, not so. This same file is opened to the clipboard.??

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Simple HTML Form</title>
</head>
<body>
<!-- Script 2.1 - form.html -->

<form action="handle_form.php" method="post">

<fieldset><legend>Enter your information in the form below:</legend>

<p><b>Name:</b> <input type="text" name="name" size="20" maxlength="40" /></p>

<p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength="60" /></p>

<p><b>Gender:</b> <input type="radio" name="gender" value="M" /> Male <input type="radio" name="gender" value="F" /> Female</p>

<p><b>Age:</b>
<select name="age">
<option value="0-29">Under 30</option>
<option value="30-60">Between 30 and 60</option>
<option value="60+">Over 60</option>
</select></p>

<p><b>Comments:</b> <textarea name="comments" rows="3" cols="40"></textarea></p>

</fieldset>

<div align="center"><input type="submit" name="submit" value="Submit My Information" /></div>

</form>

</body>
</html>

Then the .php file is

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Form Feedback</title>
<style type="text/css" title="text/css" media="all">
.error {
font-weight: bold;
color: #C00;
}
</style>
</head>
<body>
<?php # Script 2.5 - handle_form.php #4

// Print the submitted information:
if ( !empty($_POST['name']) && !empty($_POST['comments']) && !empty($_POST['email']) ) {
echo "<p>Thank you, <b>{$_POST['name']}</b>, for the following comments:<br />
<tt>{$_POST['comments']}</tt></p>
<p>We will reply to you at <i>{$_POST['email']}</i>.</p>\n";
} else { // Missing form value.
echo '<p class="error">Please go back and fill out the form again.</p>';
}
?>
</body>
</html>


Brian Chandler
QUOTE
The HTML file containing the code for the form fails to pass the variables onto the recieving .php file. This recieving .php file is called by the line <form action="handle_form.php" method="post"> but rather than placing the data assigned to the variables in the recieving .php file and displaying this file in the browser, the recieving file is 'opened to the clipboard'.


It's quite unclear what your question is. If you have a properly working web server, then the above is not a plausible description of anything that is going to happen. When you submit the form in a browser, what happens?
Christian J
QUOTE(rbbenson @ May 17 2011, 05:24 PM) *

'opened to the clipboard'.

What do you mean with that?


This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.