473,699 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

further on my fairly simple logic problem

> You can pass parameters in the URL for a POSTed form:

## page2
<form method="post" action="page3.p hp?data=$urlenc oded_data">
<input type="text" name="address">
<input type="submit">
</form>

## page3
mail('y******** ***@example.com ', 'form data with contact details',
"Someone entered this data:\n\n" .
"{$_GET['data']}\n\n" .
"The user details are:\n" .
" address: {$_POST['address']}");


Thanks for all the previous help guys!

I'm halfway there, I think. I'm getting my POST data through to the
next page, but I'm not sure how or if I can use the URLENCODE command within
the form? Whereas I used to have the data passed on like so:

echo '<a href="mail.php? radiochoice=', urlencode($radi obutton),
'&radiomoderntr ad=', urlencode($radi omoderntrad),
'&radiocoord= ', urlencode($radi ocoord),
'&radiopacking= ', urlencode($radi opacking),
'&i1=', urlencode($item 1),
'&i2=', urlencode($item 2),
'&i3=', urlencode($item 3),
'&i4=', urlencode($item 4),
'&i5=', urlencode($item 5),
'&i6=', urlencode($item 6), ETC.

when I try to do a (obviously botched?!) cut and paste job to get the
following:

<form name="form1" method="post" action="finalte st.php?stevetes t=",
urlencode($item 1),' stevetest2=', urlencode($item 2),'">
<p>

<input type="text" name="textfield ">
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>?>

I get a 'Parse error: parse error, unexpected '<'' - yes, my grasp is syntax
is pretty crappy, but I'm no programmer - just a GFX guy trying to learn!
Anyone able to help me mastering this last piece of my jigsaw?

THANKS!

Steve

Jul 17 '05 #1
4 1902
"Steve" <lu***********@ hotmail.com> wrote in message
news:40******** **************@ news.astraweb.c om...
You can pass parameters in the URL for a POSTed form:

## page2
<form method="post" action="page3.p hp?data=$urlenc oded_data">
<input type="text" name="address">
<input type="submit">
</form>

## page3
mail('y******** ***@example.com ', 'form data with contact details',
"Someone entered this data:\n\n" .
"{$_GET['data']}\n\n" .
"The user details are:\n" .
" address: {$_POST['address']}");
Thanks for all the previous help guys!

I'm halfway there, I think. I'm getting my POST data through to the
next page, but I'm not sure how or if I can use the URLENCODE command

within the form? Whereas I used to have the data passed on like so:

echo '<a href="mail.php? radiochoice=', urlencode($radi obutton),
'&radiomoderntr ad=', urlencode($radi omoderntrad),
'&radiocoord= ', urlencode($radi ocoord),
'&radiopacking= ', urlencode($radi opacking),
'&i1=', urlencode($item 1),
'&i2=', urlencode($item 2),
'&i3=', urlencode($item 3),
'&i4=', urlencode($item 4),
'&i5=', urlencode($item 5),
'&i6=', urlencode($item 6), ETC.

when I try to do a (obviously botched?!) cut and paste job to get the
following:

<form name="form1" method="post" action="finalte st.php?stevetes t=",
urlencode($item 1),' stevetest2=', urlencode($item 2),'">
<p>

<input type="text" name="textfield ">
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>?>

I get a 'Parse error: parse error, unexpected '<'' - yes, my grasp is syntax is pretty crappy, but I'm no programmer - just a GFX guy trying to learn!
Anyone able to help me mastering this last piece of my jigsaw?

THANKS!

Steve


Steve --
You have HTML in the middle of a PHP block. What you would have do is take
the HTML form out of the PHP block and then put small PHP blocks in the
middle of the form action to print the urlencodes. Example:

<?php
// define $item's here:
$item1="foo";
$item2="bar";
?>

<form name="form1" method="post" action="finalte st.php?stevetes t=<?php print
urlencode($item 1); ?>&stevetest2=< ?php print urlencode($item 2); ?>">
<p>

<input type="text" name="textfield ">
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>

hope this helped

- JP
Jul 17 '05 #2
Steve wrote:
(snip)
when I try to do a (obviously botched?!) cut and paste job to get the
following:
Where is the initial php tag?
The one that refers to the last "?>" you posted?
<form name="form1" method="post" action="finalte st.php?stevetes t=",
urlencode($item 1),' stevetest2=', urlencode($item 2),'">
<p>

<input type="text" name="textfield ">
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>?>

I get a 'Parse error: parse error, unexpected '<''
Where?
Anyone able to help me mastering this last piece of my jigsaw?


Try this:

<?php
echo '<form name="form1" method="post" action="finalte st.php?';
echo 'stevetest=', urlencode($item 1), '&';
echo 'stevetest2=', urlencode($item 2), '">';
echo '<p><input type="text" name="textfield "></p>';
echo '<p><input type="submit" name="submit" value="Submit"> </p>';
echo '</form>';
?>

Or, as another poster said, separate the HTML from the PHP.

--
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 #3
> >

Steve --
You have HTML in the middle of a PHP block. What you would have do is take
the HTML form out of the PHP block and then put small PHP blocks in the
middle of the form action to print the urlencodes. Example:

<?php
// define $item's here:
$item1="foo";
$item2="bar";
?>

<form name="form1" method="post" action="finalte st.php?stevetes t=<?php print urlencode($item 1); ?>&stevetest2=< ?php print urlencode($item 2); ?>">
<p>

<input type="text" name="textfield ">
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>

hope this helped

- JP


Thanks JP - I will try this!! Your help really is appreciated!

again, thanks,

Steve
Jul 17 '05 #4
Thanks also to you Pedro - your help is invaluable to my ongoing efforts!

Steve!

"Pedro Graca" <he****@hotpop. com> wrote in message
news:2h******** ****@uni-berlin.de...
Steve wrote:
(snip)
when I try to do a (obviously botched?!) cut and paste job to get the
following:


Where is the initial php tag?
The one that refers to the last "?>" you posted?
<form name="form1" method="post" action="finalte st.php?stevetes t=",
urlencode($item 1),' stevetest2=', urlencode($item 2),'">
<p>

<input type="text" name="textfield ">
</p>
<p>
<input type="submit" name="submit" value="Submit"> </p>
</form>?>

I get a 'Parse error: parse error, unexpected '<''


Where?
Anyone able to help me mastering this last piece of my jigsaw?


Try this:

<?php
echo '<form name="form1" method="post" action="finalte st.php?';
echo 'stevetest=', urlencode($item 1), '&';
echo 'stevetest2=', urlencode($item 2), '">';
echo '<p><input type="text" name="textfield "></p>';
echo '<p><input type="submit" name="submit" value="Submit"> </p>';
echo '</form>';
?>

Or, as another poster said, separate the HTML from the PHP.

--
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 #5

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

Similar topics

6
2065
by: Steve | last post by:
Hi All! I wonder if anyone could help me with the underlying logic of a problem I have. At the moment my working pages run like so --------------------------------------------------------- PAGE1: A form which gathers variables and POSTS them on to the next page. PAGE2: This page does a few simple calculations based on the variables gathered on PAGE1 and echoes the results to screen. It also contains a two
6
2107
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 get to second script, cause this line print "Please enter both phone number and name!";
6
1812
by: chonkme | last post by:
Hi, i have a real simple xslt problem but i just cant figure out how to do it by looking at various examples on the net. i have a xml document and in it are some elements with a "result" tag name. i want to use xslt to reproduce exactly the same xml document except with an attribute called "id" added to those elements with a "result" tag name. can this be done? if so any helps greatly appreciated
1
1077
by: Boefje | last post by:
What I want is fairly simpel, but I can't figure it out. Problem: Select the article (the articles) with the highest price for each article group. table articles --------------- id=1, description='article1', price=100, articlegroupid=4 id=2, description='article2', price=200, articlegroupid=5
2
1474
by: Jake | last post by:
Hi, I originally posted in the db group but thought this might be more appropriate here. I have a scheduling application which allows the user to reserve timeslots for various things but I'm having trouble figuring out how to detect if a reservation being added is conflicting with an existing reservation. Basically its a logic problem. I am currently able to detect timeslots that overlap start and/or end times but cant figure out how...
4
2105
by: frank | last post by:
I posted a question before (to too many groups) and this time I am sending to this group only. I have a quick script as seen below, the file_list table has a unique field called file_name. The problem I am having is that if no unique items exist, this will insert into the table fine. But if a unique item does exist it will not insert as it should. My problem is that I can not get access to return any kind of error. This is very...
11
4655
by: nicholas_ian_reese | last post by:
Hi all, I am tutoring introductory computer science in the Solomon Islands and we are using C++ as the language of choice (nice). Please note that I am no way a C++ programmer, but have but I have programmed in most mainstream languages over the paste 20 years. We are learning HOW to code, not just C++. The dudes in the class have their final assignment in a couple of days and we have a simple problem to overcome. The problem is this:
23
1749
by: Rex | last post by:
Hi I want to write a procedure which takes in a string of names seperated by a whitespace and puts commas at each whitespace the last name however, should have "and" before it. Let me explain that with the help of an example: The original string is: "Toby Grant Michelle Tom" the procedure should return "Toby, Grant, Michelle and Tom" Cheers!
3
7259
by: Shal | last post by:
Hi all, I have a table with 300,000 records in it and I want to run an update that has a few clauses in the WHERE command and just changes one boolean value on a subset of records. What I am curious about is the query, (if it works at all) takes ages to complete. I suppose 300,000 records is alot to process and I will sometimes want to change this boolean value on up to 20,000 of those, but I have had times of over an hour and it is still...
0
8685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
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
9172
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
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
8908
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
8880
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...
1
6532
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
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.