Jump to content

Recommended Posts

<html>
<body>
<?php


$db_host = "XXXXXXX";
$db_user = "XXXXX";
$db_pass = "XXXXX";
$db_name = "XXXXX";

class db {

        function connect($db_host, $db_user, $db_pass, $db_name) {
        mysql_connect($db_host, $db_user, $db_pass);
        mysql_select_db("$db_name") or die(mysql_error());
        }

        function query($query) {
        $query = mysql_query($query) or die(mysql_error());
        return $query;
        }

        function fetch_array($query) {
        $query = mysql_fetch_array($query);
        return $query;
        }

        function fetch_row($query) {
        $query = mysql_fetch_row($query);
        return $query;
        }

        function close() {
        mysql_close();
}
}

  $myDb=new db;

  $myDb->connect($db_host, $db_user, $db_pass, $db_name);

$myDb->query("INSERT into poker(link) VALUES('$link');");
function createRandomUrl() {

    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
    srand((double)microtime()*1000000);
    $i = 0;
    $pass = '' ;

    while ($i <= 15) {
        $num = rand() % 33;
        $tmp = substr($chars, $num, 1);
        $pass = $pass . $tmp;
        $i++;
    }

    return $pass;

}

$link = CreateRandomUrl();


echo "<form name='name' action='viewhand.php?link=$link' method='post'>


            

            

            

<TEXTAREA Rows =30 Cols = 75 NAME = 'pokerhand'>
Your Pokerhand Here
</TEXTAREA></br>

            

            

            

            

            

            

            

            

            

 <input type='submit' value='submit'>"
?>

</body>
</html>

 

I need to POST the textarea, but GET the link variable in the URL. Or how can i make it so when you press submit you are redirected to (action=view.php?link=1234)?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/53136-solved-get-and-post/
Share on other sites

Thats because in your form tag the method is set to post and not get

 

so:

 

echo "<form name='name' action='viewhand.php?link=$link' method='post'>

 

should be

 

echo "<form name='name' action='viewhand.php?link=$link' method='get'>

 

 

~ Chocopi

Link to comment
https://forums.phpfreaks.com/topic/53136-solved-get-and-post/#findComment-262694
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.