php-general Digest 27 May 2010 03:11:03 -0000 Issue 6766

Topics (messages 305551 through 305558):

Re: Select Values Didn't Get Passed in From Two Different Forms
        305551 by: Alice Wei
        305553 by: tedd
        305554 by: Alice Wei
        305555 by: Al
        305557 by: Nisse Engström

Re: Google checkout nightmare
        305552 by: Adam Richardson

One more time about regexes
        305556 by: Andre Polykanine
        305558 by: Nilesh Govindarajan

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---

> Date: Wed, 26 May 2010 09:19:26 -0400
> To: [email protected]; [email protected]
> From: [email protected]
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different  
> Forms
> 
> At 9:17 PM -0400 5/25/10, Alice Wei wrote:
> >No, the fields are populated in the first and second
> >form, form1 and form2. What I want to do is to get the selections from
> >both forms and pass them on to the third. Does this make sense? For some
> >  reason, the text input and the semester drop down menu result can be
> >passed to process.php, but the results that I try to select from the
> >first and second does not. So, the form is not passing the results of
> >what I had from the radio button selections.
> >
> >To illustrate, the
> >second looks something like this:
> 
> Alice:
> 
> No offense, but "Looking" like something isn't going to cut it.
> 
> I advise you to:
> 
> 1. Show us the code. -- give us a url where your code is located.
> 
> 2. Tell us what you *want* to do -- and don't show us with "it looks 
> something like this" nonsense.
> 
> 3. Get the simple stuff to work first before jumping into the harder stuff.
> 
> If you are willing to do the above, then I'll help you with your problem.
> 
> Please understand that forms are very simple with very simple rules 
> to follow. Enhancing forms with javascript routines can become 
> complicated very quickly. But if you can describe it, it can be done.
> 
> Cheers,
> 
> tedd
> 
> 


I thought I provided the whole code, but looks like it somehow got lost in the 
thread. 

Here is the main file I would like to use for my data entry:

Main:

<?php
// Make a MySQL Connection
mysql_connect("localhost", "xxx", "xxx") or die(mysql_error());
mysql_select_db("yyy") or die(mysql_error());

//The variables posted from the PHP form
$start = $_POST["start"];

?>
 <ul>
                <form action="" method="post">
                <li>Select the type of your starting point of interest:<br/>
                                <div id="start_menu"><form 
action="test_getrss.php" name="form1" method="post">
                                        <span><input type="radio" 
value="Apartment" name="start"
                                                
onclick="check(document.form1.start)"/> Apartment </span>
                                        <span><input type="radio" 
value="Grocery" name="start"
                                                
onclick="check(document.form1.start)"/> Grocery </span>                         
                       
                                </form></div></li>  </ul>           

  <form action="process.php" method="post">
                      
                        <input type="hidden" name="form1" value="<?php echo 
$start?>"/>
                       <input type="submit" value="Submit" name="submit"/>
                        <input type="reset" value="Reset" name="reset"/>
                        </form>
         
</body>
</html>

This is the script that I use to construct the drop down menu in test_getrss.php

<?php
//get the q parameter from URL
// Make a MySQL Connection
mysql_connect("localhost", "xxx", "xxx") or die(mysql_error());
mysql_select_db("xxxe") or die(mysql_error());
$q=$_GET["q"];

$query="SELECT name FROM start_from WHERE type='" . $q . "'";
//find out which feed was selected
$result = mysql_query ($query);
echo "<select name='start_location'>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[0]>$nt[0]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box 
?> 


See, I am trying to get the users pick something from the <select 
name="start_location"> and have the info in there to pass on to process.php

<?php


//get the q parameter from URL


// Make a MySQL Connection


mysql_connect("localhost", "xxx", "xxx") or die(mysql_error());


mysql_select_db("yyy") or die(mysql_error());


$form1 = $_POST['form1'];





echo "Start Location " . $form1 . "<br />";





?>

Therefore, the radio button info. does not need to be recorded. This is not the 
only field I need to pass to process.php, which the data would be used to enter 
into a database. I am leaving what is not working in my code. I hope this helps 
in understanding what my problem may be. 

Thanks for your help. 

Alice
                                          
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

--- End Message ---
--- Begin Message ---
Alice:

You provide:

 <ul>
                <form action="" method="post">
                <li>Select the type of your starting point of interest:<br/>
<div id="start_menu"><form action="test_getrss.php" name="form1" method="post"> <span><input type="radio" value="Apartment" name="start"

onclick="check(document.form1.start)"/> Apartment </span>
<span><input type="radio" value="Grocery" name="start"

onclick="check(document.form1.start)"/> Grocery </span> </form></div></li> </ul>
  <form action="process.php" method="post">
<input type="hidden" name="form1" value="<?php echo $start?>"/>
                       <input type="submit" value="Submit" name="submit"/>
                        <input type="reset" value="Reset" name="reset"/>
                        </form>
</body>
</html>


You also state:

 I hope this helps in understanding what my problem may be.

It's very apparent that your problem is multifold and to solve it we need to take the "solution" in steps.

First, the above HTML code is just plain horrible -- and that's just html part or the problem -- let alone the more complicated php/mysql/javascript coding.

If that is the best html code you can write, then I suggest that you go back to learn html before learning anything else.

So, your assignment (if you want me to continue to help) is to create a simple form to collect the data you want. Nothing fancy, just a simple form -- can you do that?

The assignment is in your court. If you can show you can do that, then we'll proceed to the next step.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---

> Date: Wed, 26 May 2010 15:36:18 -0400
> To: [email protected]; [email protected]
> From: [email protected]
> Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms
> 
> Alice:
> 
> You provide:
> 
> > <ul>
> > <form action="" method="post">
> > <li>Select the type of your starting point of interest:<br/>
> > <div id="start_menu"><form 
> >action="test_getrss.php" name="form1" method="post">
> > <span><input type="radio" 
> >value="Apartment" name="start"
> > 
> >onclick="check(document.form1.start)"/> Apartment </span>
> > <span><input type="radio" 
> >value="Grocery" name="start"
> > 
> >onclick="check(document.form1.start)"/> Grocery 
> ></span> 
> > </form></div></li> </ul> 
> >
> > <form action="process.php" method="post">
> > 
> > <input type="hidden" name="form1" 
> >value="<?php echo $start?>"/>
> > <input type="submit" value="Submit" name="submit"/>
> > <input type="reset" value="Reset" name="reset"/>
> > </form>
> > 
> ></body>
> ></html>
> 


   My bad, I cannot imagine I sent that stuff. To answer your question, here it 
is, 

 


                <form action="" method="post">
                <p>Select the type of your starting point of interest:<br/>
                     <input type="text" name="start" size="20" maxlength="50"/>

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

 

This is what is working now if I do it this way, but again, then I got to make 
sure everything is "typed up properly" before the form is submitted. Does this 
answer your questions by any chance?

 

Thanks for your help.

 

Alice

 

> 
> You also state:
> 
> > I hope this helps in understanding what my problem may be.
> 
> It's very apparent that your problem is multifold and to solve it we 
> need to take the "solution" in steps.
> 
> First, the above HTML code is just plain horrible -- and that's just 
> html part or the problem -- let alone the more complicated 
> php/mysql/javascript coding.
> 
> If that is the best html code you can write, then I suggest that you 
> go back to learn html before learning anything else.
> 
> So, your assignment (if you want me to continue to help) is to create 
> a simple form to collect the data you want. Nothing fancy, just a 
> simple form -- can you do that?
> 
> The assignment is in your court. If you can show you can do that, 
> then we'll proceed to the next step.
> 
> Cheers,
> 
> tedd
> 
> -- 
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com

                                          
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

--- End Message ---
--- Begin Message ---


On 5/26/2010 3:50 PM, Alice Wei wrote:


Date: Wed, 26 May 2010 15:36:18 -0400
To: [email protected]; [email protected]
From: [email protected]
Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

Alice:

You provide:

<ul>
<form action="" method="post">
<li>Select the type of your starting point of interest:<br/>
<div id="start_menu"><form
action="test_getrss.php" name="form1" method="post">
<span><input type="radio"
value="Apartment" name="start"

onclick="check(document.form1.start)"/>  Apartment</span>
<span><input type="radio"
value="Grocery" name="start"

onclick="check(document.form1.start)"/>  Grocery
</span>
</form></div></li>  </ul>

<form action="process.php" method="post">

<input type="hidden" name="form1"
value="<?php echo $start?>"/>
<input type="submit" value="Submit" name="submit"/>
<input type="reset" value="Reset" name="reset"/>
</form>

</body>
</html>



    My bad, I cannot imagine I sent that stuff. To answer your question, here 
it is,




                 <form action="" method="post">
                 <p>Select the type of your starting point of interest:<br/>
                      <input type="text" name="start" size="20" maxlength="50"/>

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



This is what is working now if I do it this way, but again, then I got to make sure 
everything is "typed up properly" before the form is submitted. Does this 
answer your questions by any chance?



Thanks for your help.



Alice




You also state:

I hope this helps in understanding what my problem may be.

It's very apparent that your problem is multifold and to solve it we
need to take the "solution" in steps.

First, the above HTML code is just plain horrible -- and that's just
html part or the problem -- let alone the more complicated
php/mysql/javascript coding.

If that is the best html code you can write, then I suggest that you
go back to learn html before learning anything else.

So, your assignment (if you want me to continue to help) is to create
a simple form to collect the data you want. Nothing fancy, just a
simple form -- can you do that?

The assignment is in your court. If you can show you can do that,
then we'll proceed to the next step.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

                                        
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

Alice:

First, always make certain your html code is perfect. Use W3C's validator. http://validator.w3.org/

I recommend html 1.1 It's really not much extra effort and helps greatly to insure compatibility with all modern browsers.




--- End Message ---
--- Begin Message ---
On Wed, 26 May 2010 11:02:10 -0400, Alice Wei wrote:

[De-indented to preserve sanity]

>  <ul>
>   <form action="" method="post">

Bzzt. Only <li> elements can be children of <ul>.

>   <li>Select the type of your starting point of interest:<br/>
>    <div id="start_menu">
>     <form action="test_getrss.php" name="form1" method="post">

Bzzt. You didn't close the previous <form>. You can *not*
have nested <form> elements.

>      <span><input type="radio" value="Apartment" name="start"
>                   onclick="check(document.form1.start)"/> Apartment </span>
>      <span><input type="radio" value="Grocery" name="start"
>                   onclick="check(document.form1.start)"/> Grocery </span>     
>                                            

Bzzt. Non-standard DOM references. Use

    check(document.forms.form1.elements.start)
or
    check(this.form.elements.start)
or
    check(this)

Note that the first two will pass a collection of
elements because you have two controls with the
same name. The third will pass a single element.

>     </form></div></li>
>  </ul>           
> 
>  <form action="process.php" method="post">
>                       
>   <input type="hidden" name="form1" value="<?php echo $start?>"/>
>   <input type="submit" value="Submit" name="submit"/>
>   <input type="reset" value="Reset" name="reset"/>
>  </form>

Bzzt. An input control with the same name as one of the
      forms? Wasn't it confusing enough already?


/Nisse

--- End Message ---
--- Begin Message ---
On Wed, May 26, 2010 at 10:54 AM, Ashley Sheridan
<[email protected]>wrote:

> Hi All,
>
> I'm trying to get a custom shopping cart integrated with Google
> Checkout. I've done it before with their older API, but it's changed a
> lot since I last used it. The official documentation is a mix and match
> of bits, and doesn't seem to follow any logical structure. The code
> samples Google gives only seem to work on a PHP4 system, and bring up
> countless errors on a PHP 5 system.
>
> Has anyone integrated this successfully before, or know of any decent
> PHP5 examples. I'm at my wits end, as I have to get this done today. So
> far my efforts go to the sandbox area and just say:
>
> Oops!
> Error time: 2010-05-26T14:54:24 (Coordinated Universal Time)
> (4878073251f78)
> We were unable to process your request.
>
> Which doesn't much help, as that value doesn't seem to be an error code
> (I get zero results when I Google it)
>
> Any help would be appreciated!
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
Not saying to use these, but perhaps they could enable a better
understanding of what works:

OS Commerce Module:
http://addons.oscommerce.com/info/4556

MyPHPGoogleCheckout:
http://code.google.com/p/myphpgooglecheckout/

Zen Cart Module:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=314

Google's documentation is pretty pathetic in this case.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
Hello everyone,

Sorry, but I'm asking one more time (since it's really annoying me and
I need to apply some really dirty hacks):
Is there a way making preg_replace() pass through the regex one single
time searching from left to right and not to erase what it has already
done?
I can give you a real task I'm accomplishing but the tasks requiring
that tend to multiply...
Thanks a lot!

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


--- End Message ---
--- Begin Message ---
---------- Forwarded message ----------
From: Nilesh Govindarajan <[email protected]>
Date: Thu, May 27, 2010 at 8:40 AM
Subject: Re: [PHP] One more time about regexes
To: Andre Polykanine <[email protected]>


On Thu, May 27, 2010 at 3:33 AM, Andre Polykanine <[email protected]> wrote:
> Hello everyone,
>
> Sorry, but I'm asking one more time (since it's really annoying me and
> I need to apply some really dirty hacks):
> Is there a way making preg_replace() pass through the regex one single
> time searching from left to right and not to erase what it has already
> done?
> I can give you a real task I'm accomplishing but the tasks requiring
> that tend to multiply...
> Thanks a lot!
>
> --
> With best regards from Ukraine,
> Andre
> Http://oire.org/ - The Fantasy blogs of Oire
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: http://twitter.com/m_elensule
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


If you don't want to replace the stuff it has searched then use preg_match !

--
Nilesh Govindarajan
Facebook: nilesh.gr
Twitter: nileshgr
Website: www.itech7.com



-- 
Nilesh Govindarajan
Facebook: nilesh.gr
Twitter: nileshgr
Website: www.itech7.com

--- End Message ---

Reply via email to