Wrox Programmer Forums
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To 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 March 27th, 2007, 09:38 AM
Registered User
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bhuwan81
Default php help

<form name=frm action="" method=post>
Which is the country of India.<br>
<input type=hidden name=check value=check>
<select name=country onchange=submit()>
<option value=select>Please select one....</option>
<option value=Calcutta>Calcutta</option>
<option value=Delhi>Delhi</option>
<option value=Chennai>Chennai</option>
<script language=javascript>
function submit()
  if ($_POST[country] == "Delhi")
  echo "Correct";
  echo "Incorrect";

Problem in this is when I refresh the page previous answer still appears on the page.
Suppose I selected the value Calcutta then incorrect is echoed.
When I refresh the page incorrect still appears there.
Please help me solve this problem.
Thanking you.

Old April 12th, 2007, 02:25 AM
Registered User
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to caught

Everytime the page is refreshed, the value of $_POST['COUNTRY] will be "select" and not "delhi",because its the first option u have set in ur drop-down list.
see whats ur checking condition is and whats the value of $_POST['COUNTRY] is.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Beg. PHP 5 > Ch. 11 - fetch_field.php crater BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 January 2nd, 2007 12:20 PM
PHP Warning: PHP Startup: Unable to load dynamic l surendran Beginning PHP 1 May 29th, 2006 08:49 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM
Ch. 1: PHP Installation Troubles: php3 vs php manjito BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 June 12th, 2003 03:59 PM

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