Form Submission Error on Wordpress Innerpage

I have a form on the inside template of WordPress.

<?php
/*
Template Name: Template Form Submission
*/

get_header(); ?>
<div class="entry-content">
<div style="width: 1000px;" align="left">
<form enctype="multipart/form-data" name="file_uplaod" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="name" id="name" /><br /><br />
<input type="text" name="email" id="email" /><br /><br />
File <input type="file" name="test_file" id="test_file"/><br /><br />
<input type="submit">
</form>

</div>

But the problem is PHP-SELF is not working after form submission and it is going to index.php page. I am unable to use Javascript Redirect as File Upload is here. So can anybody help me to solve it.

Answers


<?php
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
?>

then replace

 <form enctype="multipart/form-data" name="file_uplaod" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

with

<form enctype="multipart/form-data" name="resume_uplaod" action="<?php echo curPageURL(); ?>" method="post">

See http://dev.kanngard.net/Permalinks/ID_20050507183447.html


Need Your Help

Smoother Android border-radius?

android webkit css3 smooth

is there a workaround to improve border-radius on Android browser ?

Separating PHP variables in JSON string

javascript php jquery ajax json

I'm kinda lost in how to fix a problem of mine. I've got a little code on PHP that's passing data(errors, page(id, name, title etc) trough an array and that array has been set with parseJSON. If I ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.