Jump to content

form in a table?


euel

Recommended Posts

Gud morning ppl!

I nid some enlightenment,

so i have a code like this, (i removed the exact variable name and stuff to make it simple..)

 

function some_function()
{
      echo "<table>";
      echo "<th>";
        $variable_set = select_all_variable(); // function to call data
         while($variable = mysql_fetch_array($variable_set))
             {
                    echo "<form action='link.php' method='post'>";	
	    echo "<input type='hidden' name='name' value='{$variable['id']}'>";
	    echo "<input type='hidden' name='name' value='{$session_id}'>";
                    echo "<tr>"
                    echo "<td>" .  $variable['name'] . "</td>";
                    echo "<td>" .  $variable['location'] . "</td>";
                echo "<td>";
	echo "<input type='submit' name='submit' value='Submit' />";
        echo"</td>";
		echo "</tr>";
	echo "</form>";	
	}
echo "</table>";


}

 

my setup is to display the all data from the database in a table and make a submit button on each row to able to relay the id's to an another page..

my question is.. this gonna work ?

cuz when i click the submit button it doesn't send/post the data i need specifically both the hidden input type.. which will be displayed on the link.php page..

any thoughts?

thanks nub here..  :-*

Link to comment
Share on other sites

i cant seem to make it work like this..so decided to remove the form and change the submit button to a <a>

like this

 

            echo "<a href=\"link.php?event_id=" . urlencode($variable['id']) . "&user_id=" . urlencode($session_id) . "\">";

 

then throw and catch it the link.php... the only problem here is that user can see from the address bar the id's which is not a good thing cuz they might change it..  :'(

im gonna test it if will work fine on the insertion process then if it working well, I'll mark this thread as solved.

thoughts and ideas are still welcome though!  ;D

Link to comment
Share on other sites

i found out that you can encode the data using base64_encode so..

i replaced urlencode with base64_encode to make the  data a little secure.. then decode it in the link.php form which works well.

Still finishing everything to check if all works perfect..

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.