ok let me try this question thing again...

i am having a problem using <input> tags by using current values kept in a
mysql table. how do you get the values out of the table and into a form so
they show as the value= part of the tag?
i tried just aabout everything and it doesnt work even htmlspecialchars()
doesnt work.. all i get for output on the page is the rest of the script
printed on the screen after the value= part of the tag..is there any way to
fix it?


----- Original Message -----
From: "Philip Olson" <[EMAIL PROTECTED]>
To: "Sunfire" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 8:01 PM
Subject: Re: [PHP] using <input> tags with php


> On Sat, 1 Feb 2003, Sunfire wrote:
>
> > hi.. i took your idea...
> > i put the error reporting code at the top of the script and ran it as
the
> > problem was still there to see what would happen.. instead i get 0
messages
> > from the reporting system and all i get is the last 7 chars of the print
> > line and the }?> at the end of the script... so for instance if i do:
> > print("<input type=\"text\" name=\"company\" value=$new['company']\n");
> > or any variance of that statement changing around the \" and apostrophes
> > around to try different things all i get is the rest of the script
starting
> > from the \n all the way to the rest of the script where it says }?> at
the
> > end dont know if this is a bug or not but its getting hard to figure out
> > what the problem with my echo or print statements are...
> > here is the whole script:
> > its supposed to get all fields and then display in input text boxes the
> > current values in that certain record  i know i missed some stuff in it
with
> > the query but at this point was supposed to be a test to see if i could
even
> > put it in the box in the first place... but here is the code:
>
> Please step back, slow down, and write your question
> in a short concise format.  I have no clue what the
> above means.
>
> > <html>
> > <head>
> > <title>edit member</title>
> >
> > </head>
> >
> > <form action=edit1.php method=post>
> > pick some of these:<br>
> > <?php
> > error_reporting(E_ALL);
> > mysql_connect("192.4.5.6", "root", "");
> > mysql_select_db("wata");
> > $result=mysql_query("select * from members where company like 'test'");
> > while($row=mysql_fetch_array($result)){
> > print("<input type=text name=company value=\"$row[company\"]>\n\n");
>
> // Try this instead, see also: htmlspecialchars()*
> print "<input type='text' name='company' value='{$row['company']}'>";
>
> Regards,
> Philip
>
> * http://www.php.net/manual/en/faq.html.php#faq.html.encoding
>
>
> > }
> > ?>
> > <input type="submit" value="send">
> > </form>
> > </html>
> >
> > /*end*/
> > any changes to make it work would be appreciated...tnx
> >
> >
> > ----- Original Message -----
> > From: "Philip Olson" <[EMAIL PROTECTED]>
> > To: "Sunfire" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Saturday, February 01, 2003 6:48 PM
> > Subject: Re: [PHP] using <input> tags with php (IMPORTANT READ)
> >
> >
> > >
> > > On Sat, 1 Feb 2003, Sunfire wrote:
> > >
> > > > if i do this:
> > > > /*all the mysql login stuff here*/
> > > >
> > > > $query=mysql_query("select * from members");
> > > > while($new=mysql_fetch_array($query)){
> > > > echo "$new['company']";
> > > > /*so on through the field list*/
> > > > }
> > > > on output all i get is the title with a submit button..
> > > > otherwise blank..
> > >
> > >   There is a bug in PHP 4.3.0 regarding the use of arrays
> > >   in strings.  The following gave a parse error before
> > >   PHP 4.3.0:
> > >
> > >     print "Do not do this: $arr['key']";
> > >
> > >   Now it gives an E_NOTICE error due to changes to the string
> > >   scanner.  In PHP 4.3.1 it will no longer give a bogus E_NOTICE
> > >   and instead it will work (no parse error either).  Surrounding
> > >   the array with {braces} in the string works regardless, so:
> > >
> > >     print "You can do this: {$arr['key']}";
> > >
> > >   Regarding this question, don't write it like that but instead
> > >   do the following (no quotes needed):
> > >
> > >     echo $new['company'];
> > >
> > >   For those wondering about this bug, see:
> > >
> > >     http://bugs.php.net/bug.php?id=21820
> > >
> > >   The string documentation has been updated to demonstrate
> > >   the array in string phenomena (except the bug hasn't been
> > >   mentioned as I'm waiting for it to be committed first).
> > >
> > >     http://www.php.net/types.string
> > >
> > >   Sunfire, you aren't seeing this E_NOTICE error because your
> > >   error level is turned down (by default).  Put this on top
> > >   of your script to see them all:
> > >
> > >     error_reporting(E_ALL);
> > >
> > >   Regards,
> > >   Philip
> > >
> > >
> > > > same thing with fetch_object()...and i have 1 row in the members
> > table..im
> > > > sort of confused now that it doesnt work for a wierd reason
> > > >
> > > > any better ideas on how to get the stuff out of the table and into
vars?
> > > > maybe im doing it wrong
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Saturday, February 01, 2003 5:33 PM
> > > > Subject: Re: [PHP] using <input> tags with php
> > > >
> > > >
> > > > > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time,
> > > > > [EMAIL PROTECTED] writes:
> > > > >
> > > > > >i tried getting the values into vars using
fetch_array/fetch_object
> > and
> > > > > >fetch_row and tried to put them in variables but for some odd
reason
> > it
> > > > > >really doesnt work because when i try to use the vars in the
value
> > > > section
> > > > > >instead of printing in the edit box the content of the variable i
> > usually
> > > > > >end up with "?>", ">", "<?php", or "}?>" instead... any reason
this
> > shows
> > > > > >up? and when i do:
> > > > > >echo "<input type=text name=$name value='$new_var'>";
> > > > > >then on the web page i end up with some thing like this instead
of
> > the
> > > > edit
> > > > > >box:
> > > > > >">";;">
> > > > > >}?>
> > > > > >any reason for that?
> > > > >
> > > > > It sounds like $name and/or $new_var may be empty. Did you echo
the
> > > > variables
> > > > > before using them in your form to check whether the values from
the
> > > > database
> > > > > are actually in the variables?
> > > > >
> > > > > Janet
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > >
> > > >
> > > > ---
> > > > Outgoing mail is certified Virus Free.
> > > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to