Jump to content

Global or not! grrrr...


monkeytooth

Recommended Posts

Ok I just spent a couple days rebuilding a form for someone. Somewhat quite elaborate at that, it works on my server (godaddy), works on a couple of my friends servers.. but this one persons server it doesnt work on.. go figure.

 

So I think I figured out my problem but don't know how to get around it without recoding everything. Which I don't want to do cause theres alot of stuff to be done that be the case, its not just some simple contact form, it a form with 35 or so fields, and just 5 of them are 100+ possible variables.. all hard coded into the php cause they don't have a database handy to make things a bit easier..

 

anyway. ironicly my problem is run into using $_POST.. remember when that didn't exisit... yea, didn't know that going into making this form a couple days ago.. so anyone know what I can do to make $_POST work? when I should be just using $var? the host is apparently using php v4.4 dunno if that means anything.. but im open to ideas.. help please

Link to comment
https://forums.phpfreaks.com/topic/91407-global-or-not-grrrr/
Share on other sites

$_POST[] is used when you posted a form to that php script file.

 

Hmm let say you post a form to test.php. So in test.php:

<?php
$var = $_POST['your_form_field_name'];
?>

Is actually an array to hold all your form's information. Which mean your form will look something like this:

<input type="text" name="your_form_field_name" ... />

 

Remember, the $_POST can only be used if the server request is posting a form. What is mean is, you can check it like this:

 

<?php
if($_SERVER['REQUEST_METHOD'] == "POST")
{
    echo 'You are posting a form!';
}
?>

 

And your form header will look like this:

<form name="form_name" action="test.php" method="POST">

 

Your method must used post.

 

Try search some article on google about form posting on php.

Link to comment
https://forums.phpfreaks.com/topic/91407-global-or-not-grrrr/#findComment-468372
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.