hello
this is my problem

how can do that in php ?

<html>

<FORM>
<TABLE BORDER="0">


<TR><TD>  facbook account :</TD>    <TD><INPUT TYPE="text" NAME="facbook account" MAXLENGTH="50"><TD><INPUT TYPE="SUBMIT" NAME="save1" VALUE="save"></TD></TR>

</FORM>
</html>

thanks

Heres something to start you off:

<?php
if(isset($_POST['facebookaccount'])){
    $acc = $_POST['facebookaccount'];
}else{
    $acc = false;
}
?>
<html>
<body>
    <form action='post'>
        <table BORDER="0">
            <tr>
                <td>facbook account :</td>
                <td><input type="text" name="facebookaccount" maxlength="50"/></td>
                <td><input type="SUBMIT" name="save1" value="save"/></td>
            </tr>
        </table>
    </form>
    <?php
    if($acc !== false){
        echo "http://www.facebook.com/{$acc}";
    }
    ?>
</body>
</html>

Heres a reference to setcookie() you can store data on a users pc with that

oh , thanks alot

but i want show facebook icon in another bage <
how can do that ?

im confused, i wrote it to go to facebook?

Member Avatar for diafol

OK, I think I get it. You want to save the facebook account data in the user's profile data. Then when you enter the user's profile page, the facebook icon takes you to the facebook account page.

1) Set up form as you've done (html code).
2) Set up a processing page (php code) to accept the $_POST data. This is then used to update the user's profile in your DB. If this is successful, redirect to the profile page, otherwise redirect to the form page.
3) The profile page takes info from the DB to build the facebook icon link:

if(isset($fb_account))echo "<a href=\"http://www.facebook.com/$fb_account\" target = \"_blank\"><img src=\"imgs/fb_icon.png\" /></a>

how can save account in database if enter ?
and then display if enter icon facebook

Because this code not the desired result :""(
please help me ,,

Member Avatar for diafol

DO you know mysql and how to manipulate it in php? If not, bone up on this - plenty of resources on the internet.

yes , i know ,,

mysql

Member Avatar for diafol

I left end off code:

if(isset($fb_account))echo "<a href=\"http://www.facebook.com/$fb_account\" target = \"_blank\"><img src=\"imgs/fb_icon.png\" /></a>";

my try

code start.php

<?php
if(isset($_POST['facebookaccount'])){
    $acc = $_POST['facebookaccount'];
}else{
    $acc = false;
}
?>
<html>
<body>
    <form action="go.php" method="get">
        <table BORDER="0">
            <tr>
                <td>facbook account :</td>
                <td><input type="text" name="facebookaccount" maxlength="50"/></td>
                <td><input type="SUBMIT" name="save1" value="save"/></td>
            </tr>
        </table>
    </form>


</body>
</html>

code go.php

<?php
if(isset($acc))
echo "<a href=\"http://www.facebook.com/$acc\" target = \"_blank\"><img src='http://www.buttonshut.com/Facebook-Buttons/Facebook-Buttons-1-10-.png'/></a>";
?>

this code not working

this out put :
!

sort of

<form action="go.php" method="get">

There are 2 methods to send data, one is GET this sends the variables in the url and the other is POST which sends the variables in the HTTP request, might be best not to bother going into POST - just say it sends the variables in a hidden way to the next page.

eg.
GET -> URL = go.php?facebookaccount=kkkkk
no extra data

POST -> URL = go.php
extra data = facebookaccount=kkkkk

Now on your go.php page, php picks up these variables and assigns them to 2 different arrays:

GET data goes into -> $_GET

POST data goes into -> $_POST

They both use the key for reference as set in the input name <input name='facebookaccount'/>

eg

echo $_GET['facebookaccount'];//in the above example using method = 'GET' will print out "kkkkk"
echo $_POST['facebookaccount'];//in the above example using method = 'POST' will print out "kkkkk"

It is safer to use POST when you can

See if you can get go.php working with that!

thanks alot :)
i solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.