2012-06-07 43 views
1

我的圖像上載表單在我的個人檔案編輯頁面上不起作用。這兩種形式在獨立工作時必須分開。圖像上傳腳本在提交配置文件編輯表單之前上傳圖像。在單個頁面上有多個表單

我在一個單獨的頁面上測試了圖片上傳,它是頁面上唯一的東西,它工作。所以我認爲這是其他形式搞亂了它。這兩種形式在不同的腳本上運行,兩種方法都是帖子。

這裏是JScript

<script type="text/javascript" src="imageupload/scripts/jquery.min.js"></script> 
<script type="text/javascript" src="imageupload/scripts/jquery.form.js"></script> 
<script type="text/javascript" > 
    $(document).ready(function() { 
    $('#photoimg').live('change', function() { 
     $("#preview").html(''); 
     $("#preview").html('<img src="imageupload/loader.gif" alt="Uploading...."//>'); 
     $("#cropimage").ajaxForm({ target: '#preview' }).submit(); 
    }); 
    }); 
</script> 

這裏的形式;

<form id="cropimage" method="post" enctype="multipart/form-data" action="../imageupload/ajaximage.php"> 
    <input type="file" name="photoimg" id="photoimg" class="filebutton"/><br> 
</form> 

這是另一種形式。它很長;

echo '<form action="phpscripts/artistupdate.php" method="post" id="profileedit"><input type="text" name="artistname" value="'. $row['artistname'].'" class="name"  maxlength="80"><span id="editlink"><t1>Your profile link will be: <br><a  href="http://newbornsounds.co.uk/artists/artist.php?artist='.$row['artistname'].'"> <b>http://newbornsounds.co.uk/artists/artist.php?artist=<FONT style="BACKGROUND-COLOR: yellow">'.$row['artistname'].'</font></b></a></span><br><div id="urlwarn"><t1>Please note that if you change your url all the links you have placed outside of NBS will be affected.</t1></div>'; 
    } 
} 
?> 
<hr> 
<?php 
    $username = $_SESSION['username']; 
    $pass = $_SESSION['password']; 
    include ("../database.php"); 
    $result = mysql_query("SELECT * FROM members WHERE username='$username' AND  password='$pass' AND artist='Y'"); 

    while($row = mysql_fetch_array($result)){ 
    echo '<div id="artistsbio"><textarea name="bio" rows="10" cols="80" name="bio" value="'.  $row['bio']. '" class="bio">'. $row['bio']. '</textarea><br><div id="probwarn"><t1>Everything is still in the beta stage so there are bound to be a few problems. If you spot one please <a  href="mailto:[email protected]"><b>tell us about it.</b></a></t1></div>'; 
    } 
?> 
<br><br> 
<input type="submit" name="submit" value="Done" class="button"></form> 
+1

表單的完整html是什麼樣的?你不能嵌套表單。 – jeroen

+0

其他形式在哪裏? –

+0

請確保您有兩個提交按鈕,用於您的每個表單 –

回答

0

您的cropimage表單中沒有提交按鈕,可能是pb。 如果我理解的很好,你希望在沒有提交按鈕的情況下在photoimg字段發生變化時提交它。

嘗試Submitting a form by pressing enter without a submit button (如果不想顯示,在屏幕外部顯示提交按鈕)。

順便說一句,jQuery的生活已過時。 http://api.jquery.com/live/

+0

感謝您的回答。我已經明白了。原來,我的memberstoolbar中的JavaScript與提交表單的javascript行發生混淆。但是,感謝您說.live函數已被棄用。沒有意識到 –

+0

奇怪,我把生活轉爲開啓,但它不再適用於。發生了什麼? –

相關問題