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
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.

Link to comment
Share on other sites

 

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 = 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.