473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

form submit??

I can't seem to figure our why this doesn't work. I don't get any errors, it just doesn't submit. Can anyone shed some light.

<?PHP
$var1 = "http://localhost/php/index.php";
$varx = "bruce";
echo "<form name='formx3' method='post'><input type='text'><input type=button value=go onclick=document.formx3.action='".$var1."'; document.formx3.submit();></form>";
?>

I got it working using the following...but I want to know why the above code is not working.
<?PHP
$var1 = "http://localhost/php/index.php";
$varx = "bruce";
echo "<form name='formx2' action='".$var1."'><input type='text'><input type=button value=go onclick=document.formx2.submit();></form>";
?>

TIA
-Bruce
Jul 17 '05 #1
5 3672
Bruce Duncan wrote:
This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C444BA.D9A547B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I can't seem to figure our why this doesn't work. I don't get any =
errors, it just doesn't submit. Can anyone shed some light.

<?PHP
$var1 =3D "http://localhost/php/index.php";
Bad syntax!
$varx =3D "bruce";
Bad syntax!
echo "<form name=3D'formx3' method=3D'post'><input type=3D'text'><input =
type=3Dbutton value=3Dgo onclick=3Ddocument.formx3.action=3D'".$var1."'; =
document.formx3.submit();></form>";
Bad syntax! ?>

I got it working using the following...but I want to know why the above =
code is not working.
I don't know JavaScript ... your form does not have a submit button!

Maybe you get better answers by posting your plain HTML and JavaScript
to a JavaScript newsgroup.
<?PHP
$var1 =3D "http://localhost/php/index.php";
Bad syntax!
$varx =3D "bruce";
Bad syntax!
echo "<form name=3D'formx2' action=3D'".$var1."'><input =
type=3D'text'><input type=3Dbutton value=3Dgo =
onclick=3Ddocument.formx2.submit();></form>";
Bad syntax!

Your form does not have a submit button. I wonder how this works ???
?> (snip a bunch of seemingly ramdom characters) ------=_NextPart_000_000A_01C444BA.D9A547B0--


--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
"Pedro Graca" <he****@hotpop.com> wrote in message
news:2h************@uni-berlin.de...
Bruce Duncan wrote:
This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C444BA.D9A547B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I can't seem to figure our why this doesn't work. I don't get any =
errors, it just doesn't submit. Can anyone shed some light.

<?PHP
$var1 =3D "http://localhost/php/index.php";


Bad syntax!
$varx =3D "bruce";


Bad syntax!
echo "<form name=3D'formx3' method=3D'post'><input type=3D'text'><input = type=3Dbutton value=3Dgo onclick=3Ddocument.formx3.action=3D'".$var1."'; = document.formx3.submit();></form>";


Bad syntax!
?>

I got it working using the following...but I want to know why the above = code is not working.


I don't know JavaScript ... your form does not have a submit button!

Maybe you get better answers by posting your plain HTML and JavaScript
to a JavaScript newsgroup.
<?PHP
$var1 =3D "http://localhost/php/index.php";


Bad syntax!
$varx =3D "bruce";


Bad syntax!
echo "<form name=3D'formx2' action=3D'".$var1."'><input =
type=3D'text'><input type=3Dbutton value=3Dgo =
onclick=3Ddocument.formx2.submit();></form>";


Bad syntax!

Your form does not have a submit button. I wonder how this works ???
?>

(snip a bunch of seemingly ramdom characters)
------=_NextPart_000_000A_01C444BA.D9A547B0--


I aplogize for the html formatted post...forgot to change the setting back.
Here it is again...if you can help. I didn't write this code...I'm
debugging someone else's badly formatted code!

This code doesn't do anything:
<?PHP
$var1 = "http://localhost/php/index.php";
$varx = "bruce";
echo "<form name='formx3' method='post'><input type='text'><input
type=button value=go onclick=document.formx3.action='".$var1."';
document.formx3.submit();></form>";
?>
This code works, but I want to know why the above code doesn't.
<?PHP
$var1 = "http://localhost/php/index.php";
$varx = "bruce";
echo "<form name='formx2' action='".$var1."'><input type='text'><input
type=button value=go onclick=document.formx2.submit();></form>";
?>
Thanks again in advance...
-Bruce


Jul 17 '05 #3
Bruce Duncan wrote:
I aplogize for the html formatted post...forgot to change the setting back.
Here it is again...if you can help. I didn't write this code...I'm
debugging someone else's badly formatted code!

This code doesn't do anything:
<?PHP
$var1 = "http://localhost/php/index.php";
$varx = "bruce";
echo "<form name='formx3' method='post'><input type='text'><input
type=button value=go onclick=document.formx3.action='".$var1."';
document.formx3.submit();></form>";
?>
This code outputs this HTML (reformatted):

<form name='formx3' method='post'>
<input type='text'>
<input type=button value=go
onclick=document.formx3.action='http://localhost/php/index.php';
document.formx3.submit();>
</form>
This code works, but I want to know why the above code doesn't.
<?PHP
$var1 = "http://localhost/php/index.php";
$varx = "bruce";
echo "<form name='formx2' action='".$var1."'><input type='text'><input
type=button value=go onclick=document.formx2.submit();></form>";
?>


This code outputs this HTML (reformatted):

<form name='formx2' action='http://localhost/php/index.php'>
<input type='text'>
<input type=button value=go
onclick=document.formx2.submit();>
</form>


The differences between the output of the two scripts are:

1. the form in the first script has the attribute method and
the form in the second script has the attribute action

both forms should have method="post" and action="something"
unless JavaScript can replace any of those attributes
2. the first onclick has two instructions -- I really do not know if
JavaScript accepts that.

So, it seems your problem is with JavaScript -- sorry I can't help you.



In plain and simple HTML, we need a submit button to submit the form,
which neither of the scripts produces.

The PHP on both is ok :)

I'd rewrite both of your scripts the same way:

========
<?php
$var1 = 'http://localhost/php/index.php';
$varx = 'bruce';
// the following uses "heredoc" syntax: check it out @
// http://www.php.net/manual/en/language.types.string.php

echo <<<HTML
<form name="formx3" method="post" action="$var1">
<input type="text" name="unnamed_input" value="$varx"/>
<input type="submit" value="go"/>
</form>
HTML;

?>
========

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #4
Bruce Duncan wrote:
I'm new to PHP...and my previous post was a bit premature.**I've*narrowed
my problem down to this:

I have this very simple form in test1.php

<form name='formx6' action="testz.php?varxy=1">
**<input*type="text">
**<input*type="submit"*value="sub">
</form>

That's more clean and sure:

<form name='formx6' method="post" action="testz.php">
**<input*type="hidden"*name="varxy"*value="1">
**<!--*that*displays*`test_edit`*as*default*string*in*th e*UI*-->
**<input*type="text"*name="anyvar"*value="test_edi t"*size="30"*>
**<input*type="submit"*value="sub"*name="Submit*yo ur*data"*title="Klick
here :)">
</form>
Why is it that the querystring on testz.php looks like:
http://localhost/php/testz.php?


default form method is 'GET'. If you want to hide the `?...`
than use the 'POST' method :=}

cu

================================================== =====
*****-^-******|*B.*Eschrich,*Software*Engineer
****(O.O)*****|*Mobile:*+49*(0)*174*/*88*00*458
-ooo-\-/-ooo- | Office: +49 (0) 89 / 378 24101

eMail: bj*************@schlundmail.de**Don't*shit*where
Home : http://www.eschrich.de.vu*******you*eat*!
================================================== =====
Jul 17 '05 #5
I noticed that Message-ID: <2h************@uni-berlin.de> from Pedro
Graca contained the following:
2. the first onclick has two instructions -- I really do not know if
JavaScript accepts that.

So, it seems your problem is with JavaScript -- sorry I can't help you.


Why the JS anyway? (which won't work if JS is disabled)
Why not just use <input type='submit' value='Go'>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #6

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

Similar topics

1
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...
2
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...
2
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,...
4
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:...
15
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...
6
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...
4
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...
5
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'...
5
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...
1
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.