Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending Variables in Post without the input tag

Tags:

html

post

php

I want to send only one variable via the post method. I have queried the database and have to post $row[id] variable to the page along with the form. To send the user's input we simply write like <input type="text" name="xyz"></input> and then we access it as $_POST[xyz]. This way we can send a variable that a user write. But, I want to send something that user has not written but there in my sending file as $row['id']. So, I want to send this variable as well. How can I do that? And also how will I be able to access that?

like image 272
w2lame Avatar asked Dec 22 '22 02:12

w2lame


2 Answers

use <input type="hidden">

like image 165
Your Common Sense Avatar answered Jan 08 '23 08:01

Your Common Sense


define that variable after post. :)

set $row['id'] = 'valueXYZ'; at post script. more effective to prevent cheating $_POST value

like image 44
apis17 Avatar answered Jan 08 '23 07:01

apis17