473,386 Members | 1,924 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,386 software developers and data experts.

simple formm & $_POST

I have this form:

<form action="http://www.XXXXXXX.com/form.php" method="post"
name="form1" target="_blank" id="form1">
<label>Nome &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="<b>name</b>" type="text" maxlength="45" />
</label>
<p>
<label>Last
<input name="last name" type="text" dir="ltr" maxlength="45" />
</label>
</p>

now, i have made this php script just to echo the value in "name" and
"last" but it doesn't work:

<?php
print("$_POST['name']");
print("thanks, see you soon");
?>

what's the error?

May 29 '07 #1
5 1820
vinnie kirjoitti:
I have this form:

<form action="http://www.XXXXXXX.com/form.php" method="post"
name="form1" target="_blank" id="form1">
<label>Nome &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="<b>name</b>" type="text" maxlength="45" />
Remove the <b></bfrom input name.
</label>
<p>
<label>Last
<input name="last name" type="text" dir="ltr" maxlength="45" />
</label>
</p>

now, i have made this php script just to echo the value in "name" and
"last" but it doesn't work:

<?php
print("$_POST['name']");
print("thanks, see you soon");
?>

what's the error?
You can test what was posted with
print_r($_POST);

It's often very helpful in debugging the input data.

--
Ra*********@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
May 29 '07 #2
En las nuevas, el vinnie escribió:
I have this form:

<form action="http://www.XXXXXXX.com/form.php" method="post"
name="form1" target="_blank" id="form1">
<label>Nome &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="<b>name</b>" type="text" maxlength="45" />
</label>
<p>
<label>Last
<input name="last name" type="text" dir="ltr" maxlength="45" />
</label>
</p>

now, i have made this php script just to echo the value in "name" and
"last" but it doesn't work:

<?php
print("$_POST['name']");
print("thanks, see you soon");
>>

what's the error?

<input name="<b>name</b>"

should be

<input name="name"
May 29 '07 #3
>
You can test what was posted with
print_r($_POST);

It's often very helpful in debugging the input data.

--
Rami.Elo...@gmail.com
i did, but this is what i get:
<<
Array(form1(name))
thanks, see you soon
>>
While i was expecting the name that the user has typed in. Is there
anything missing?

May 29 '07 #4
vinnie wrote:
>>
You can test what was posted with
print_r($_POST);

It's often very helpful in debugging the input data.

--
Rami.Elo...@gmail.com

i did, but this is what i get:
<<
Array(form1(name))
thanks, see you soon
>>>

While i was expecting the name that the user has typed in. Is there
anything missing?
Hi Vinnie

print_r need <pretags, like this:

echo "<pre>";
print_r($_POST);
echo "</pre>";

for output that you can actually read being human. :)

Regards,
Erwin Moller
May 29 '07 #5
vinnie wrote:
I have this form:

<form action="http://www.XXXXXXX.com/form.php" method="post"
name="form1" target="_blank" id="form1">
<label>Nome &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="<b>name</b>" type="text" maxlength="45" />
</label>
<p>
<label>Last
<input name="last name" type="text" dir="ltr" maxlength="45" />
</label>
</p>

now, i have made this php script just to echo the value in "name" and
"last" but it doesn't work:

<?php
print("$_POST['name']");
Besides the namingproblem (boldtags), another thing:
You use:
print("$_POST['name']");

Why do you use the "" around the $_POST["name"] ?
simply do:
echo $_POST['name'];

You said you are a novice. My advise would be NOT to use
variablesubstitution in strings untill you understand what is happening.

eg:
$name="vinnie";
echo "Your name is $name";

Works just fine, but it is excactly the same as:
echo "Your name is".$name;

The above example wasn't very tricky, but this one is worse:
$name[0]["firstname"] = "vinnie";
echo "Your name is $name[0]["firstname"]";

which will result in an error (because of the "" used as stringdelimmiter
and in the name-array.).

Easier is just to assemble your string using . as glue:
echo "Your name is ".$name[0]["firstname"];
Regards,
Erwin Moller
print("thanks, see you soon");
?>

what's the error?
May 29 '07 #6

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

Similar topics

8
by: Steve Fitzgerald | last post by:
The below login script does work. The form does not seem to be submitting. I keep getting the username and password fields. The only errors I get are notices that email and password and undefined...
4
by: Dariusz | last post by:
I am a beginner in PHP and MySQL, and am working through a book and various online tutorials on PHP and MySQL and now stuck - installed everything on "localhost" and it all works fine. My question...
1
by: Raptor | last post by:
I'm using a single script to generate a table with <input>s in each row. I fill the array with initial values, then write it out to the table and let the user edit the values. Something like: ...
6
by: Robert Rozman | last post by:
Hi, I'm total php newbie and probably have trivial problem. I have following two scripts. First creates web form and should run second script with two arguments. But those two arguments don't...
13
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
3
by: George Doka | last post by:
Hi, I'm an html-guy getting his feet wet in PHP. I DL'd a simple server-side mail script from the 'net and have been trying to modify it so it includes a CC and BCC function. the form page...
1
by: helraizer1 | last post by:
Hi all, I have a dynamic image that picks out data from a dynamically created .line file. showimage.php(5) <?php include("linesfile.php5"); $linesDataFile = new DataFile("data.line");
1
George Lft
by: George Lft | last post by:
ok, first of all, i built my register page using dreamweaver tool which the codes haven been out of control. Now i'm thinking that turning over everything - by using this another set of codes. And...
1
by: helraizer1 | last post by:
Hi folks, In my script I have this code: <?php unset($errors); include ("linesfile.php5");
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.