Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2011, 02:50 AM
Registered User
 
Join Date: Nov 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help pls (getting error in 5 chapter Form elements

The first program is not running correctly
it's not working
its the first code
Code:
<!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">
<head>
<title>Say my name</title>
</head>
<body>
<form action="formprocess.php"	method="post">
<table>
<tr>
<td>Name</td>
<td>rihit</td>
</tr><tr>
<td colspan="2"	style="text-align:center;">
<input type="submit"	name="Submit"	value="Submit"	/></td>
</tr>
</table>
</form>
</body>
</html>


2nd file is as follow
Code:
<html >
<head>
<title>Untitled Document</title>
</head>
<body>
<?php
echo '<h1>Hello'  .$_POST['name'].'!</h1>';
?>
<pre>
<strong>DEBUG:</strong>
<?php
print_r($_POST);
?>
</pre>
</body>
</html>
it's not working please check this out and reply soon
Regards
Rohit
991-5858-991
 
Old November 29th, 2011, 06:50 AM
Friend of Wrox
 
Join Date: May 2011
Posts: 125
Thanks: 0
Thanked 24 Times in 24 Posts
Default

Greetings,

Change the first file to this:
Code:
<!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">
<head>
<title>Say my name</title>
</head>
<body>
<form action="formprocess.php"	method="post">
<table>
<tr>
<td>Name</td>
<td><input type="text" name="name" value="" size="20" /></td>
</tr>
<tr>
<td colspan="2"	style="text-align:center;"><input type="submit"	name="Submit"	value="Submit"	/></td>
</tr>
</table>
</form>
</body>
</html>
Assuming the other file will be named: processform.php it will, or should, now work as you now have a textbox called name which will be passed to the processform script in the POST array.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Resizing of Form Elements Relative to Form Shape in C# Bill_Thompson C# 2005 2 April 28th, 2010 07:41 PM
Chapter 17, pls help Mugen86 BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 3 October 5th, 2009 07:34 AM
Javascript error: form.elements[...]..... mars123 Javascript How-To 0 November 28th, 2007 02:37 AM
PictureBox in MDI Form Pls Help! hamidawan VB.NET 2002/2003 Basics 2 October 10th, 2006 10:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.