PHP HELP!!! I have the following link in page 1 echo "
How do you get to the third page?
Every link in PAGE 1 leads to its own unique page(PAGE 2) where there is an edit button. You click it and you go to PAGE 3.
I've tried using sessions but they didn't work.. or i didn't use them properly. hidden seems too difficult. my friend told me i just pass the values like i did on PAGE 2 to pass the ids like, $sid = $_GET['sid']; $oid = $_GET['oid']; but doing this on page 3 didn't do anything. when i look at the url of PAGE 3, i don't see id numbers or anything.
Why not put the get parameters in page 3?
you mean, just do $sid = $_GET['sid']; $oid = $_GET['oid']; on PAGE 3?
You need to put `?sid=...&oid=...` on the page link for it to work
the page link in which page? PAGE 2?
Basically, $_GET is just the parameters in the link
You need to explain better what you're trying to do
I'm passing two values, OID and SID from PAGE 1 to PAGE 2 and I want to pass the same values from PAGE 2 to PAGE 3.
How do you get to page 3 though?
with an edit button. no worries, i just fixed it
You can use single quotes in an html echo instead of escaped double quotes (\")? Sweet, never new that. If you are sending data from one page to another, you might want to first urlencode the data; ie ``` <? php function redirect($toPage) { header("Location: " . $toPage . "?" . urlencode("oid=thisandthat")); } ?> ``` If you were to encode url strings before the ?, I think you would use rawurlencode() - and intercepting the data I think you use rawurldecode, and urldecode, but don't hold me to it; I'm fairly new to php myself.
That's because some of the characters you send in a URL wouldn't work unless they were encoded.. not quite sure why though.
I have two post variables. $sid = $_POST['SID']; $oid = $_POST['OID']; But when I try to insert these values in an attribute of a database, it doesn't work. Why?
``` insert these values in an attribute of a database ``` What do you mean? The more code you show & description the better.
$query = " INSERT INTO `file` ( `name`, `mime`, `size`, `data`, `created`, `sid`, `oid`, `task` ) VALUES ( '{$name}', '{$mime}', '{$size}', '{$data}', NOW(), '{$sid}', '{$oid}', '{$exam}' )";
So I'm uploading a file to mysql database through a form made by using php script. There is a table called "file" with the above columns: name, mime, size, data, created, sid, oid, and task in the mysql database. When I choose file and click submit on the page I made, the file DOES go to the database, along with the other values like name, mime and such. So the INSERT INTO statement is working. However, only sid and oid values are not going to the database. The two lines I posted up defines sid and oid. They are defined correctly; when I do 'echo $sid' and 'echo $oid', I get 1 and 79 respectively. Those are the right numbers. I'm getting sid and oid values through the url from another page.
I guess the next thing to check is whether oid and sid are text / varchar datatypes in the mysql database.. if they are int types, you'll want to remove the single-quotes in your INSERT statement.
Ok. I also have another question. In a table, I have a series of rows with each row having two radio buttons. one is called assignment, the other is called exam. When i made those rows with radio buttons, I did 'checked= checked' for the 'assignment' radio button. I made sure to give each row a different 'name' so the 'assignment' radio button would be selected in each row. However, I'm still seeing only one radio button in the table being selected. When I click on other radio buttons, I notice it is being shared. What do I need to do to fix this?
I'm not sure.. but probably separate <form> bodies for each set of radio buttons.
I got it. thanks
You can use the include or require functions. Then you'll get the php variables in the other page
Join our real-time social learning platform and learn together with your friends!