Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

database value to post

General discussions related to php

Moderators: macek, egami, gesf

database value to post

Postby Takeshi » Sat Oct 26, 2013 9:59 am

Hi all,

I have a problem. At first ... I read a values into a form, method post, like this ...
Code: Select all
$row = mysql_query("SELECT MID(nazov,1,1) AS nazov FROM book GROUP BY MID(nazov,1,1)");

while ( $db = mysql_fetch_assoc($row) )
{
print "<form id=myForm method=post action=blablabla>";
print "<input type=text name=id value=".$db['nazov'].">";
print "</form>";
print "<a href=\"#\" onclick=\"myForm.submit()\" >".$db['nazov']."</a>";
}


but when I try to read a $_POST['id'] value on page blablabla .... it loads me always the first value of table .... and i dont know why ..... can you help me?
Takeshi
New php-forum User
New php-forum User
 
Posts: 7
Joined: Fri May 17, 2013 3:07 am

Re: database value to post

Postby johnj » Mon Oct 28, 2013 12:37 am

make sure you have the right query....make sure the query is picking the data that you want and then debug to see why $_POST is behaving in an odd manner.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron