Jump to content

Forms don't detect javascript


Guardian-Mage

Recommended Posts

I have a form on my website with two radio buttons. When you click one, a text field appears, the other triggers a file form. The problem is, when i do this and process the form with PHP, none of my javascript forms are detected

 

Javascript File:

<!--
function writeLocal()
{
document.getElementById("texthere1").innerHTML="<td>Movie Screenshot</td><td><input type=\"file\" name=\"screen\" id=\"screen\" onchange=\"imageUpload(this.value)\" /></td>";
}

function writeRemote()
{
document.getElementById("texthere1").innerHTML="<td>Movie Screenshot</td><td><input type=\"text\" id=\"movie_image\" name=\"movie_image\" size=\"30\"maxlength=\"250\"  /></td>";
}

function writeLocal2()
{
document.getElementById("texthere2").innerHTML="<td>Movie Upload</td><td><input type=\"file\" name=\"movie\" id=\"movie\"  /></td>";
}

function writeRemote2()
{
document.getElementById("texthere2").innerHTML="<td>Movie Location</td><td><input type=\"text\" name=\"movie_location\" id=\"movie_location\" size=\"30\"maxlength=\"250\"  /></td>";
}

function writeYoutubeYes()
{
document.getElementById("youtube_text").innerHTML="<td><b>Youtube Address</b></td><td><input type=\"text\" id=\"movie_youtube\" name=\"movie_youtube\" size=\"30\" maxlength=\"250\"value=\"http://www.youtube.com/watch?v=\" /></td>";
}

function writeGoogleYes()
{
document.getElementById("google_text").innerHTML="<td><b>Google Video Address</b></td><td><input type=\"text\" id=\"movie_google\" name=\"movie_google\" size=\"30\" maxlength=\"250\"value=\"http://video.google.ca/videoplay?docid=\" /></td>";
}

function writeYoutubeNo()
{
document.getElementById("youtube_text").innerHTML="";
}

function writeGoogleNo()
{
document.getElementById("google_text").innerHTML="";
}

//-->

 

And the Form file

<?php
session_start();
    if (@$_SESSION['auth'] != "yes")  /* Checks if the user is logged in*/
    {
       header("Location: index.php");
       exit();
    }
$head_extra = "<script type= \"text/javascript\" src= \"Plugin_01/movie_functions.js\"></script>";
include "Plugin_01/return_id.php";
?>
<?php include "layout.phtml"; ?>
<p>
Welcome to the Live News Movie Creater. This manager will guide you through
the process of adding a new movie to your LNS Feed Pages. If this is not
what you would like to do, you should return to the <a href="LiveNews.php">
Live News Service</a> Control Panel.
</p>
<table>
<?php 
if (isset($_GET['err']))
$errmsg = $_GET['err'];
{
echo "<tr><td colspan='2'><b style=\"color: red \">$errmsg</b></td></tr>";
}
?>
<form id="liveupdate" name="liveupdate" method="POST"
action="Plugin_01/movie_add_sql.php" enctype="multipart/form-data">
<tr>
<td><b>Movie ID</b></td>
<td><input type="text" id="movie_id" name="movie_id" value="<?php echo $only_id ?>" readonly="readonly" /></td>
</tr>

<tr>
<td><b>Movie Type</b></td>
<td><select name="movie_type" id="movie_type">
<option value="official">Official Movie</option>
<option value="game">Video Game Movie</option>
</select>
</td>
</tr>

<tr>
<td><b>Movie Title</b></td>
<td><input type="text" id="movie_title" name="movie_title" size="30"
maxlength="250" value=""  /> </td>
</tr>

<tr>
<td><b>Movie Subject</b></td>
<td><input type="text" id="movie_subject" name="movie_subject" size="30"
maxlength="250" value="" /></td>
</tr>

<tr>
<td><b>Movie Screenshot:</b></td>
</tr>

<tr>
<td>Specify Server Location:</td>
<td><input type="radio" id="no_id1" name="no_id1" value="remote" onclick="writeRemote();" /></td></tr>
<tr><td>Specify Local Location:</td>
<td><input type="radio" id="no_id1" name="no_id1" value="local" onclick="writeLocal();" /></td>
</tr>

<tr id="texthere1">
</tr>

<tr>
<td><b>Movie Location:</b></td>
</tr>

<tr>
<td>Specify Server Location:</td>
<td><input type="radio" id="no_id2" name="no_id2" value="remote" onclick="writeRemote2();" /></td></tr>
<tr><td>Specify Local Location:</td>
<td><input type="radio" id="no_id2" name="no_id2" value="local" onclick="writeLocal2();" /></td>
</tr>

<tr id="texthere2">
</tr>

<tr>
<td><b>Movie Image Desc.</b></td>
<td><input type="text" id="movie_alt" name="movie_alt" size="30" maxlength="250"  /></td>
</tr>

<tr>
<td><b>Available on Youtube:</b></td>
<td>Yes<input type="radio" id="no_id3" name="no_id3" value="yes" onclick="writeYoutubeYes();" />
No
<input type="radio" id="no_id3" name="no_id3" value="no" onclick="writeYoutubeNo();" /></td>
</tr>

<tr id="youtube_text">
</tr>

<tr>
<td><b>Available on Google Video:</b></td>
<td>Yes<input type="radio" id="no_id4" name="no_id4" value="yes" onclick="writeGoogleYes();" />
No
<input type="radio" id="no_id4" name="no_id4" value="no" onclick="writeGoogleNo();" /></td>
</tr>

<tr id="google_text">
</tr>

<input type="hidden" id="should_upload" name="should_upload" size="30" maxlength="30"
value="true" />
<tr>
<td colspan="2" class="center">
<input type="submit" id="submit" value="Update Live News!" name="submit" />
</form>
</table>
<?php include "layout2.phtml"; ?>

 

And PART of the PHP File

$movie_id2      = $_POST['movie_id'];       //This is the movie id
$movie_title    = $_POST['movie_title'];    //This is the movie title
$movie_subject  = $_POST['movie_subject'];  //This is the movie subject
$movie_image    = $_POST['movie_image'];    //This is the movie image
$movie_img      = $_FILES["screen"]["name"];//This is the movie image uploaded by the user
$movie_upload   = $_FILES["movie"]["name"]; //This is the uploaded movie
$movie_location = $_POST['movie_location']; //This is the uploaded movie
$movie_youtube  = $_POST['movie_youtube'];  //This is the uploaded movie
$movie_google   = $_POST['movie_google'];   //This is the uploaded movie
$do_youtube     = $_POST['no_id3'];         //This is the uploaded movie
$do_google      = $_POST['no_id4'];         //This is the uploaded movie
$movie_alt      = $_POST['movie_alt'];      //This is the movie screenshot alt text
$movie_date     = date("Y-m-d");            //This is the movies date
$screen_func    = $_POST['no_id1'];         //This is the movies date
$movie_func     = $_POST['no_id2'];         //This is the movies date
$movie_type     = $_POST['movie_type'];     //This is the movies date

 

No matter what, the forms triggered by javascript appear empty.

 

Help is appreciated,

 

Brandon

Link to comment
https://forums.phpfreaks.com/topic/53096-forms-dont-detect-javascript/
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.