jgkgopi Posted June 11, 2011 Share Posted June 11, 2011 Hi all I have this code for display some name,content this is the url http://localhost:8080/mobile/main.php if i give like this http://localhost:8080/mobile/main.php?name=babu i will get babu details i want to this babu through a text can u help me <?php require_once('Connections/final.php'); ?> <?php $colname_Recordset1 = "-1"; if (isset($_GET['name'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['name'] : addslashes($_GET['name']); } mysql_select_db($database_final, $final); $query_Recordset1 = sprintf("SELECT * FROM final WHERE name = '%s'", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $final) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mysql_free_result($Recordset1); ?> Quote Link to comment https://forums.phpfreaks.com/topic/239034-post-text-in-php-to-fetch-data/ Share on other sites More sharing options...
mikesta707 Posted June 11, 2011 Share Posted June 11, 2011 What do you mean by "I want to this babu through a text".. I have no idea what you are asking for help with here. Do you mean you want to pass babu through a form? if so read this tutorial on forms: http://www.tizag.com/htmlT/forms.php and how they work with php: http://www.tizag.com/phpT/examples/formex.php Set the method of the form to post, and then you can access the post data through the $_POST super global. if this is not what you want you need to clarify your question. Quote Link to comment https://forums.phpfreaks.com/topic/239034-post-text-in-php-to-fetch-data/#findComment-1228214 Share on other sites More sharing options...
jgkgopi Posted June 11, 2011 Author Share Posted June 11, 2011 I want to pass name via form If i use the code like this i can fetch data but i want the url to ?name=babu like that <?php $db=mysql_connect("localhost","root",""); mysql_select_db("lasttry"); $username = $_POST['textfield']; //echo $username; echo '</br>'; $query = mysql_query("SELECT * FROM final WHERE name = '$username'"); while($result = mysql_fetch_array($query)) { //display echo $result['content']; echo '<br/>'; echo $result['conclusion']; }/* $result = MYSQL_QUERY($query); $data = Quote Link to comment https://forums.phpfreaks.com/topic/239034-post-text-in-php-to-fetch-data/#findComment-1228226 Share on other sites More sharing options...
mikesta707 Posted June 11, 2011 Share Posted June 11, 2011 try setting your forms action from post to get. Quote Link to comment https://forums.phpfreaks.com/topic/239034-post-text-in-php-to-fetch-data/#findComment-1228230 Share on other sites More sharing options...
jgkgopi Posted June 11, 2011 Author Share Posted June 11, 2011 Fine thank you working Quote Link to comment https://forums.phpfreaks.com/topic/239034-post-text-in-php-to-fetch-data/#findComment-1228231 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.