473,789 Members | 2,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get form to submit???

I have some php code to handle the following form is submitted, but
because there are two places the form submits I get an error. If the
drop down changes, the php code will grow the number of city/state
combinations, if the button is clicked the data is added to the
database. Perhaps there is a better way to grow the number of
city/state combinations while still retaining any text previously typed
into the input boxes?

Thanks for your help!

<html>
<body>
<table border="0">
<form method="post" action="test.ph p">
<tr>
<td colspan="4">Def ine up to 50 City/State
combinations.<b r/><br/></td>
</tr>
<tr>
<td colspan="4">Ins ert
<select name="showCity" onchange="submi t()" >
<option selected value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
</selectCities:<b r/>
</td>
</tr>
<tr>
<td>City:</td>
<td>&nbsp;<inpu t type="text" name="city0" size="20" value=""
maxlength="100" /></td>
<td align="right">& nbsp;&nbsp;&nbs p;<b><u>State</u>:</b></td>

<td>
<select name="state0" size="1" >
<option value=""></option>
<option value="AK">AK</option>
<option value="AL">AL</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>

<option selected value="CA">CA</option>
</select>
</td>
</tr>
<tr>
<td colspan="4" align="center"> <br/>
<input type="submit" name="submit" value="Add" />
</td>
</tr>
</form>
</table>
</body>
</html>

Jan 17 '07 #1
3 1440
Greg Scharlemann wrote:
I have some php code to handle the following form is submitted, but
because there are two places the form submits I get an error.
An error? WHAT error?
<table border="0">
<form method="post" action="test.ph p">
Your HTML is invalid. http://validator.w3.org/
<select name="showCity" onchange="submi t()" >
window.submit() is undefined by default, and you don't define it in
your code.

Possibly you want to call it as a method of a form element?

Jan 17 '07 #2
ASM
Greg Scharlemann a écrit :
I have some php code to handle the following form is submitted, but
because there are two places the form submits I get an error. If the
drop down changes, the php code will grow the number of city/state
combinations, if the button is clicked the data is added to the
database. Perhaps there is a better way to grow the number of
city/state combinations while still retaining any text previously typed
into the input boxes?

Thanks for your help!

<html>
<body>
<table border="0">
what does do here this form tag outside regular way of html flux ?
<form method="post" action="test.ph p">
<tr>
<td colspan="4">Def ine up to 50 City/State
combinations.<b r/><br/></td>
</tr>
<tr>
<td colspan="4">Ins ert
<select name="showCity" onchange="submi t()" >
onchange="this. form.submit()"

onchange="submi t.click();"
(it would have been much more better to haven't named your submit-button
'submit' ... ! )
<option selected value="1">1</option>
<option value="2">2</option>
.../...
<option value="50">50</option>
</selectCities:<b r/>
</td>
</tr>
<tr>
<td>City:</td>
<td>&nbsp;<inpu t type="text" name="city0" size="20" value=""
maxlength="100" /></td>
why with an align=right do you need those spaces ?
<td align="right">& nbsp;&nbsp;&nbs p;<b><u>State</u>:</b></td>
<td>
<select name="state0" size="1" >
<option value=""></option>
..../...
<option selected value="CA">CA</option>
</select>
</td>
</tr>
<tr>
<td colspan="4" align="center"> <br/>
<input type="submit" name="submit" value="Add" />
</td>
</tr>
</form>
</table>
</body>
</html>


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 17 '07 #3
>
onchange="this. form.submit()"
That did it!
>
(it would have been much more better to haven't named your submit-button
'submit' ... ! )
I changed the name of the button for simplicity sake.
Thanks for the help!

Jan 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5752
by: monika | last post by:
hi ... I have an asp page which has 3 buttons. <p align="center"><input class="button" type="button" onClick="location='welStudent.asp';" value="Click to write a new story"></p> <p align="center"><input class="button" type="button" onClick="location='draftedStory.asp';" value="Click to complete the drafted story"></p> <p align="center"> <input class="button" type="submit" value="Click to view your grade sheet" name="submit"> </p>
2
5552
by: Matt | last post by:
Can form.submit() submit another form? In the following example, in page1.asp, it is fine to submit the current form: form1.submit(), and and I could see the value "Joe" in page2.asp. However, if I do: form3.submit(), then it couldn't go to page2.asp. Any ideas?? Thanks!! //page1.asp <html> <head> </head> <body onload="form1.submit()"> //OK!
2
73383
by: Terence Parker | last post by:
How does one go about submitting a form with a link - but submitting it to a new window AND to a page different to that described within the action="" option of the <form> tag? Say, for example, I have a simple form such as the following: <form method="POST" action="submit.php" name="AForm"> Name: <input type="text" name="Name" length="20"><br> Age: 15 <a href="age.php">change age</a><br> <input type="submit" name="submit"...
4
7796
by: Sarah | last post by:
Hi all. I have a form, and several text and image links on it that should submit the form with different actions. I prepared a simple page with just the code that's not working. PROBLEM: The form won't submit if the link is clicked, but will submit if the SUBMIT button is clicked. I need to call a function to change the form's action according to user's input before it is submitted.
15
6580
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and the buttons. The problem is when I post a form to itself, the Enter key will not submit the form, it only clears the contents of the text box. The only way I can submit is to click the submit button. Here is a simplified version of my code that I...
6
3107
by: CJM | last post by:
Can somebody clarify if/how/when a simple form is submitted when the <Enter> key is pressed? As I understood it, if you have a form with a single submit button, if enter is pressed, the form should be submitted as if the button is pressed. Is this correct? Does this behaviour vary across browsers? Chris
4
9303
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form action="MaintNotification.php?ReqID=5" method="post" name="frm5"> <tr align="left" bgcolor="#dddddd" class="text" onClick="submit()"
5
8451
by: rjames.clarke | last post by:
I have the following. $result=mysql_query($sql); $nrows=mysql_num_rows($result); for ($i=0;$i<$nrows;$i++) { $row_array=mysql_fetch_row($result); echo "<form name='testform' action='ins_op.php' method='post'>"; lots of form stuff
5
17713
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input type=password maxlength="8" name="password" value="`pss`"> where usr and pss are sent from the previous form.
1
10828
by: gbezas | last post by:
Hi All, I have added an event handler to redirect form.submit() to a newSubmit() method that I have defined (which does some additional processing before submitting the form). Additionally I have defined the relavant function method in the code for details) The issue is that when Icall targetForm._submit() method from the newSubmit() function the page I get an 'Object doesn't support this property or method' error I am using IE...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.