[PHP] Form Loop
I'm trying to create a form with a loop. I need to append a value to a field name each time through the loop. For Instance: while ($row = mysql_fetch_assoc($result)) { $x=1; echo tr; echo tdinput type='text' id='qty' name='quantity_' size='2' value='$row[qty]' //td; echo /tr; $x++; } the name value quantity needs the value of x appended to it. quantity_1, quantity_2 etc. What is the correct syntax to achieve this, especially the parsing to get it to work. I suspect the dot operator to append it but I can't get the parsing down. Terry Daichendt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Login
I want to open a page if a login is correct and another if not. What is the function to open a page in PHP? Can you show me a simple example of the syntax? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error message
The error message told it all. Jochem was correct albiet not in the style I prefer. I had the code in an HTML page after the header. I've been a programmer for 15 years but I'm brand new to PHP. Anyone can make a rookie mistake. Thanks everyone for the help. Everyone was partially correct in assessing the problem. Terry Eric Gorr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sep 18, 2008, at 5:52 PM, Terry J Daichendt wrote: I'm pasting this code from the example at php.net and getting these errors. Can anyone determine what I'm doing wrong? ?php // page1.php session_start(); echo 'Welcome to page #1'; $_SESSION['favcolor'] = 'green'; $_SESSION['animal'] = 'cat'; $_SESSION['time'] = time(); // Works if session cookie was accepted echo 'br /a href=page2.phppage 2/a'; // Or maybe pass along the session id, if needed echo 'br /a href=page2.php?' . SID . 'page 2/a'; ? Well, this is weird. When I copied your text and tried it myself, the error I got was: Parse error: syntax error, unexpected T_STRING in /Users/ericgorr/ Sites/page1.php on line 9 Now, of course, there is nothing visibly wrong with line 9 ($_SESSION['animal'] = 'cat';). But, when I had my text editor show invisible characters, there were some on that line and line 10. Do you have a text editor that can show invisible characters? On the Mac, the one I really like (and is free) is TextWrangler (http://www.barebones.com/products/textwrangler/ ) and has this capability. This may be part of your problem. Once I got rid of the invisible characters, the example worked without any problems. Also, are you certain there are no spaces or anything (even invisible characters) before ?php? Whenever I've gotten a similar error in the past, that was nearly always the problem. You are welcome to compress the text file and send it to me directly so I can see exactly what it contains. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error message
I'm pasting this code from the example at php.net and getting these errors. Can anyone determine what I'm doing wrong? ?php // page1.php session_start(); echo 'Welcome to page #1'; $_SESSION['favcolor'] = 'green'; $_SESSION['animal'] = 'cat'; $_SESSION['time'] = time(); // Works if session cookie was accepted echo 'br /a href=page2.phppage 2/a'; // Or maybe pass along the session id, if needed echo 'br /a href=page2.php?' . SID . 'page 2/a'; ? Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/terryswe/public_html/hisdailybread/session.php:6) in /home/terryswe/public_html/hisdailybread/session.php on line 9 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/terryswe/public_html/hisdailybread/session.php:6) in /home/terryswe/public_html/hisdailybread/session.php on line 9 Welcome to page #1 Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error message
You have a real attitude problem, please don't bother with me again. Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Terry J Daichendt schreef: I'm pasting this code from the example at php.net and getting these which example might that be, with 1000's of built in functions you can imagine there is probably more than one. errors. Can anyone determine what I'm doing wrong? yes. but can your read? the error message tells you what is wrong. output started at /home/terryswe/public_html/hisdailybread/session.php:6 basically the body of a http request must come after the http headers, sessions make use of cookies. the first echo (or print) statement effectively starts the output of the http request body after which no headers can be sent anymore. what is also plainly obvious is that the example code you posted is *NOT* the code your trying to run: there is no session_start() called on line 9 in the example you gave. ?php // page1.php session_start(); echo 'Welcome to page #1'; $_SESSION['favcolor'] = 'green'; $_SESSION['animal'] = 'cat'; $_SESSION['time'] = time(); // Works if session cookie was accepted echo 'br /a href=page2.phppage 2/a'; // Or maybe pass along the session id, if needed echo 'br /a href=page2.php?' . SID . 'page 2/a'; don't bother with the above line, it's shite. which is a short way of saying that you have no idea as to the security ramifications so best not to even go there. ? Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/terryswe/public_html/hisdailybread/session.php:6) in /home/terryswe/public_html/hisdailybread/session.php on line 9 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/terryswe/public_html/hisdailybread/session.php:6) in /home/terryswe/public_html/hisdailybread/session.php on line 9 Welcome to page #1 Terry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php