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 December 19th, 2003, 01:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default


First of all, $_POST is not a command, it's a variable, just like $choice is. That said, you should be able to do anything with $_POST['...'] as you can with $choice.

Second, 'choice1' is the index into the $_POST array. If you add <br> to that string, you're attempting to access a comletely different index. By index here, I mean that $_POST is a structure that allows you to associate a value with a name. The name of your values are 'choice1', 'choice2', and 'choice3'. There are no values named 'choice1<br>', which is why you get nothing.


Simple answer:

echo $_POST['choice1'] . "<br>";

   OR

echo "$_POST[choice1]<br>";

  OR (as I prefer:)

echo "{$_POST['choice1']}<br>";


For more info on variable substitution and string parsing, read the manual:
  http://www.php.net/types.string



Take care,

Nik
http://www.bigaction.org/
 
Old February 28th, 2012, 07:03 AM
Registered User
 
Join Date: Feb 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default As above

Along with the suggestions above, although it takes longer, you can also separate the code onto multiple lines.





Similar Threads
Thread Thread Starter Forum Replies Last Post
INPUT BOX IN ASP/VBSCRIPT chinedu Classic ASP Basics 8 February 15th, 2007 02:47 PM
does not work register.php in ch 11 begining php5 tanvir_math BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 February 7th, 2007 05:03 PM
Input Box return value pakman Excel VBA 1 June 15th, 2005 04:29 AM
Input Box tucker Access VBA 2 May 21st, 2004 03:43 PM
Double search using an input text box Karel Access VBA 2 October 25th, 2003 10:29 PM





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