Jump to content

Post text in php to fetch data


jgkgopi

Recommended Posts

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);
?>

Link to comment
https://forums.phpfreaks.com/topic/239034-post-text-in-php-to-fetch-data/
Share on other sites

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.

 

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 = 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.