Urlencode URL Vars

The urlencode function transforms a string into something which is safe to have in a browser’s URL request window. The web server returns the string to its original state.

$new_composite = urlencode($new_composite);
$string = "<a href=\"$php_self?composite=$new_composite\">$nextPhrase_IN</a>";

Example:

          // Send the confirmation email
          $encoded_email = urlencode($_POST['email']);
          $mail_body = <<<EOMAILBODY
Thank you for registering at www.gxsam11.net. Click this link
to confirm your registration:

http://www.gxsam11.net/web/confirm.php?hash=$hash&email=$encoded_email

Once you see a confirmation message, you will be logged into
www.gxsam11.net
EOMAILBODY;
          mail($email, 'www.gxsam11.net registration confirmation',
            $mail_body, 'From: noreply@gxsam11.net');
          // Give a successful registration message
          $feedback = 'YOU HAVE SUCCESSFULLY REGISTERED.
            You will receive a confirmation email soon';
          return $feedback;
Advertisements

About samehramzylabib

See About on https://samehramzylabib.wordpress.com
This entry was posted in Hyperlink as GET, PHP Code Snippets, PHP Form Processing, PHP String and tagged , , , , , , , . Bookmark the permalink.

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s