Jump to content

Recommended Posts

Hi , I am having problem with my code. It returns error when i submit.My code look like this:

 

add_newsign.php

<------------------------------------------begin add_newsign.php--------------------------------------------->

<form id="form1" name="form1" method="post" action="add_newsign_action.php">

                <table width="499" border="0" align="center" cellpadding="3" cellspacing="3">

                  <tr>

                    <td width="135">Category</td>

                    <td width="343">

 

<select name="categoryID">

<?php

include("dbconnect.php");

$sql = "SELECT * FROM tblSignWordCategory ";

 

$rs = mysql_query($sql);

 

while($row = mysql_fetch_array($rs))

{

  echo "<option value=\"".$row['intCategoryID']."\">".$row['vcCategory']."\n  ";

}

?>

</select>

 

 

                    </label></td>

                  </tr>

                  <tr>

                    <td>Sign Word </td>

                    <td><input name="vcSignWord" type="text" id="vcSignWord" /></td>

                  </tr>

                  <tr>

                    <td>Meaning</td>

                    <td><textarea name="vcSignWordMeaning" cols="35" rows="7" id="vcSignWordMeaning"></textarea></td>

                  </tr>

                  <tr>

                    <td>Example Sentences </td>

                    <td><textarea name="vcSignWordUsage" cols="35" rows="7" id="vcSignWordUsage"></textarea></td>

                  </tr>

                  <tr>

                    <td> </td>

                    <td> </td>

                  </tr>

                  <tr>

                    <td colspan="2"><label>

                        <div align="center">

                          <input type="submit" name="Submit" value="Submit" />

                          <input type="reset" name="Reset" value="Reset" />

                        </div>

                      </label></td>

                  </tr>

                </table>

                  </form>

 

<------------------------------------------ end add_newsign.php--------------------------------------------->

 

 

<-----------------------------begin add_newsign_action.php----------------------------->

 

<?php

$intCategoryID=$_POST['intCategoryID'];

$vcSignWord=$_POST['vcSignWord'];

$vcSignWordMeaning=$_POST['vcSignWordMeaning'];

$vcSignWordUsage=$_POST['vcSignWordUsage'];

 

include("dbconnect.php");

 

 

$query="INSERT INTO tblSignWord (intCategoryID,vcSignWord,vcSignWordMeaning,vcSignWordUsage) VALUES ('".$intCategoryID."','".$vcSignWord."','".$vcSignWordMeaning."','".$vcSignWordUsage."')";

 

mysql_query($query) or die ('Error updating database');

 

 

 

echo "SignWord List updated with: ".$vcSignWord."";

echo " <a href='signword_list.php'>Return to SignWord list</a>";

?>

<-----------------------------end add_newsign_action.php----------------------------->

You should use the same name what you have used in the form, but in your action file you have used different name,

 

change the name here

$intCategoryID=$_POST['intCategoryID'];

to
$intCategoryID=$_POST['categoryID'];

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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