PHP - Quick $_post Question
I have data that is in a form right now being displayed in a textbox because I want the user to see the 'name' but the data that needs to be passed when submit is pressed is the id of the entity. So if I have <label id = "username" Value = "3"> Heintzman</label> can I use $_Post to retrieve that value once the form has been submitted because I dont want the data to be displayed in a textbox it looks ugly and isnt long enough for the text without editing.
Similar TutorialsHi, I just wanted to know how posting works?. i know how to sort of post and get info.. What i want to know is: is it possible to post something from a folder structure like so: http://wwww.xxx.com/postfolder1/postfolder2/postfolder3/postfolder4/form.php // this is the file that posts.. lets say! a username. to http://www.xxx.com/notpostfolder1/notpostfolder2/notpostfolder3/notpostfolder4/index.php // the file that gets the post : The username.. or is a php database the only answer to transfer the information? i also just discovered that in cookies if i ad path/ the cookie is valid through out the site.. is ther something like this for Post and get?? Hello Guys, I have a question. I have the following code to grab all of my $_POST vars and run through my filter function Code: [Select] foreach($_POST as $key => $value) { $mydata[$key] = filter($value); } Before using the foreach loop I was just doing the basic $var1 = $_POST['var1']; $var2 = $_POST['var2']; I'm going to have about 40 - 50 $_POST vars so my question is how do i return it as just a $var name instead of having to do this echo "<br><br><br>example1" . $mydata['var1']; echo "<br><br><br>example2" . $mydata['var2']; I guess its hard for me to explain.. Thanks for your help! Does storing multiple values in 1 database field with a varchar let's say set at 150, all separated by "|'s" so I don't have to create a field name for each one is it better performance wise or no? (storing 6-7 different |'s that will be outputted with a array ofc) ? hey guys i have a script that creates a cookie named "MyLoginPage" now everything works well the cookie is saved and it keeps the user logged in The Question ok so im wanting to create a link that will delete the cookie so when the user clicks the link it will delete the cookie is this possible?? if so, how?? many thanks Is there a way to only output the first, say, 30 words of a variable? I have a way to do it in mind, but seems like it's messy and not practical. Any suggestions? E.g: WITHOUT LIMIT: Welcome to my store. Would you like to buy something? We have really good noodles and fishes in doodle pools. WITH LIMIT: Welcome to my store. Would you like... Sort of like a short preview. code <?php //storecodefound.php v1.0 //purpose is to store the http refer and the code associated with the site to a db to be collected and verified by submitcode.php $code = $_GET['code']; $site = $_SERVER['HTTP_HOST']; //check to see if the code already present $connect = mysql_connect("localhost","root","") or die (mysql_error()); $check = mysql_query("SELECT code FROM hunter.codes WHERE code='$code'") or die (mysql_error()); $row = mysql_num_rows($check); echo "result of \$row is ".$row; echo "<br />"; if ($row = 0) { //insert into db cause it's not there mysql_query("INSERT INTO hunter.codes (id, code, site) VALUES ('','$code','$site')") or die (mysql_error()); } else { //echo it's already here echo "Code already found on server!"; } ?> my question is the result of $row is infact 0 and the if statement says if $row is 0 to insert into db and instead it's given me the code is already found? hi. when i get into some function manual and there is a note says. Quote This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. . is that meaning that after 5.3.0 version this function will not be supported? thanks , Mor. What is the difference between these two lines Code: [Select] !isset($_POST[$requiredField]) and Code: [Select] !$_POST[$requiredField] I am starting to learn PDO by re-writing one of my existing scripts. Do I still need to validate $_GET or does PDO do the work for me? Currently I am using: Code: [Select] $id = $_GET['id']; $sth = $dbh->prepare('DELETE FROM van_reservations WHERE id = :id'); $sth->bindParam(':id', $id, PDO::PARAM_INT); $sth->execute(); I used to validate by using this: Code: [Select] $id = isset($_GET['id']) && is_numeric($_GET['id'])?(int) $_GET['id']:0; hey! I have a site where I want to use multiple issets at the same time, like if I have four buttons and four issets: if(isset($_POST['one'])) { echo '<div class="example_box">one</div>'; } if(isset($_POST['two'])) { echo '<div class="example_box">two</div>'; } if(isset($_POST['three'])) { echo '<div class="example_box">three</div>'; } if(isset($_POST['four'])) { echo '<div class="example_box">four</div>'; } but for some reason it seems like only one isset can be activate at a time, is there any way to work this out or something :s? I've tried some variants of elseif stuff and such, but yeah, I'm pretty new at this stuff how to open a site with curl that has frames ? when ive tried it gives "your broswer does not support frames" ... Hi, I've seen code like this multiple times, but I don't really know what it means. function funcName(&$something) { // whatever } What exactly does the "&" do before the variable? Hi I have a quick question. I want my javascript to be able to access my php page because my php page has the coding to access the database and then it has to give me a list of the stuff in the database the alert box. This is the code that I have. I know that I can use it but I'm not sure how to go about it. getPHPResponse=function(){ var url="/countries/ajax_return_response"; $.post(url, {'format': 'JSON', 'countries': '$countries'}, function(data){ //this is where jsvascript must do something alert(data); }); } Say, Code: [Select] $ok = 'ABCDEFG' What is the command to check whether $ok contains 'C'? quick question... I have a column in my table called views. I want to reset the column to 0 for each row in the table. What's the easiest way to do this? Hi guys/girls, any pointers on this would be greatly appreciated. basically i have a table called HORSES with 2 fields: HORSE_ID and HORSE_NAME. I want to create a page which dynamically shows all the horse ID's, then a checkbox, then the horse names which can be edited. You can then edit a horse name, click the edit checkbox, and post the form to edit the database. The Form shows the fields easily enough, but doesnt update the database for some reason. Anyone got any ideas? <?php include("..\connection\connection.php"); $conn = oci_connect($UName,$PWord,$DB) or die("Couldn't logon."); if(empty($_POST["check"])) { $query = "SELECT * FROM HORSE ORDER BY HORSE_NAME"; $stmt = oci_parse($conn,$query); oci_execute($stmt); ?> <form method="post" action="horsemultiple.php"> <table border="1" cellpadding="5"> <tr> <th>Horse_ID</th> <th>Edit</th> <th>Horse Name</th> </tr> <?php while ($namearray = oci_fetch_array ($stmt)) { ?> <tr> <td><?php echo $namearray["HORSE_ID"]; ?></td> <td align="center"> <input type="checkbox" name="check[]" value="<?php echo $namearray["HORSE_ID"]; ?>"> </td> <td align="center"> <input type="text" size="5" name="<?php echo $namearray["HORSE_ID"]; ?>" value="<?php echo $namearray["HORSE_NAME"]; ?>"> </td> </tr> <?php } ?> </table><p /> <center> <input type="submit" value="Update Selected Horses"> </center> </form> <?php oci_free_statement($stmt); } else { foreach($_POST["check"] as $id) { $query = "UPDATE HORSE set HORSE_NAME = ".$_POST[$id]. " WHERE HORSE_ID ='".$id."'"; $stmt = oci_parse($conn,$query); oci_execute($stmt); header("location: ../horse.php"); } } oci_close($conn); ?> Hello everyone, With the recent time change, I found a new problem with my code. I think I have it fixed by utilizing the "date_default_timezone_set()" function, but I have a question. Does this php time/date function automatically account for daylight savings time, is it something that will have to be adjusted in my code? I think I can figure out how to adjust it if it's needed, but I don't want to have to do the work if it is updated automatically. Thanks for any help. Long story short i'm paginating database results. So pages = results / res-per-page-limit but 28 / 10 will be 2.8 should i use round() or ceil()? I need to use a HTML form to retrieve data in a certain order of ascending/descending using a drop down box and a true/false statement button for one of the values from a MySQL database. Im guessing I need a php script to query the database, but can I add the php code to the HTML or upload a php to the server that links the HTML thank you Hello, If we have large amount of data we always use SCP to copy data from remote server. scp -P 100 user@192.168.2.3: /home/user/folder /home/user1/folder/. But if DSL (Internet) of local computer disconnects I observed failure of transfer many times and this whole process becomes irritating. Is there any alternative way to use scp or rsync with php so that we can execute it with script ? Something like this ? <?php // Having shell access but its not working 4 me... $conn = ssh2_connect('ftp.server.com', 100); ssh2_auth_password($conn 'user', 'pass'); ssh2_scp_send($conn, '/local/filename', '/remote/filename', 0644); ?> Another question is there any way we can run such code with the help of shell_exec() or is this implementation is secure? Thanks in Advance! |