Jump to content

$_POST?


Zoofu

Recommended Posts

if(isset($_POST['Submit']) && !$errors)
{
echo "<h1>Video uploaded!</h1>";

$sel3=mysql_query("SELECT * FROM `users` WHERE `id`=".$_SESSION['uid']."") OR die(mysql_error());
$rowt3=mysql_fetch_array($sel3);
    	$reply = $_POST['reply'];
            $sql4 = "INSERT INTO `videos` (`path`,`uid`,`vidname`) VALUES ('videos/".$image_name."','".$row['id']."','".$reply."')";
            $res4 = mysql_query($sql4) or die(mysql_error());

}

?>



<!--next comes the form, you must set the enctype to "multipart/frm-data" and use an input type "file" -->
<form name="newad" method="post" enctype="multipart/form-data" action="">
<table>
<tr><td class=\"forum_header\" ><input type="file" name="image"></td></tr>
<tr><td class=\"forum_header\" ><input type="text" name=\"reply\"></td></tr>
<tr><td class=\"forum_header\" ><input name="Submit" type="submit" value="Upload video"></td></tr>
</table>
</form>

 

For some reason, it puts the path and uid into the respective fields, bur $reply won't go into vidname?

Link to comment
https://forums.phpfreaks.com/topic/175601-_post/
Share on other sites

The \ escape characters in -

 

name=\"reply\"

 

cause the POST index name to literally contain the double-quote characters. Why are those \ escape characters in there? You don't have them on any of the other name="..." attributes that do work.

Link to comment
https://forums.phpfreaks.com/topic/175601-_post/#findComment-925317
Share on other sites

$sql4 = "INSERT INTO `videos` (`path`,`uid`,`vidname`)

VALUES ('videos".$image_name."','".$row['id']."','".$reply."')";

 

 

 

  \" .  .\"        -- this is how you can use php variable in between with double quotations

  \'.  .\'          -- with single quotation 

 

wrong;

VALUES ('videos".$image_name."',

 

 

you can concat string with this variable.

$videos = videos . $image_name;

 

and follow the syntax shown above

correct;

VALUES (\" .  $videos  .\"  ,

 

 

Link to comment
https://forums.phpfreaks.com/topic/175601-_post/#findComment-925327
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.